diff --git a/python/ycm/client/event_notification.py b/python/ycm/client/event_notification.py index c190e6e2..4aa7825a 100644 --- a/python/ycm/client/event_notification.py +++ b/python/ycm/client/event_notification.py @@ -17,6 +17,8 @@ # You should have received a copy of the GNU General Public License # along with YouCompleteMe. If not, see . +import traceback +from ycm import vimsupport from ycm.client.base_request import BaseRequest, BuildRequestData @@ -33,7 +35,15 @@ class EventNotification( BaseRequest ): request_data.update( self._extra_data ) request_data[ 'event_name' ] = self._event_name - self.PostDataToHandler( request_data, 'event_notification' ) + # On occasion, Vim tries to send event notifications to the server before + # it's up. This causes intrusive exception messages to interrupt the user. + # While we do want to log these exceptions just in case, we post them + # quietly to the Vim message log because nothing bad will happen if the + # server misses some events and we don't want to annoy the user. + try: + self.PostDataToHandler( request_data, 'event_notification' ) + except: + vimsupport.EchoText( traceback.format_exc() ) def SendEventNotificationAsync( event_name, extra_data = None ):