diff --git a/python/ycm/client/base_request.py b/python/ycm/client/base_request.py index 72d39fee..507af7fb 100644 --- a/python/ycm/client/base_request.py +++ b/python/ycm/client/base_request.py @@ -163,6 +163,16 @@ def JsonFromFuture( future ): return None +def HandleServerException( exception ): + serialized_exception = str( exception ) + + # We ignore the exception about the file already being parsed since it comes + # up often and isn't something that's actionable by the user. + if 'already being parsed' in serialized_exception: + return + vimsupport.PostVimMessage( serialized_exception ) + + def _ValidateResponseObject( response ): if not utils.ContentHexHmacValid( response.content, diff --git a/python/ycm/client/completion_request.py b/python/ycm/client/completion_request.py index b6700155..6178bbd6 100644 --- a/python/ycm/client/completion_request.py +++ b/python/ycm/client/completion_request.py @@ -17,9 +17,9 @@ # You should have received a copy of the GNU General Public License # along with YouCompleteMe. If not, see . -from ycm import vimsupport from ycmd.utils import ToUtf8IfNeeded -from ycm.client.base_request import BaseRequest, JsonFromFuture +from ycm.client.base_request import ( BaseRequest, JsonFromFuture, + HandleServerException ) TIMEOUT_SECONDS = 0.5 @@ -46,7 +46,7 @@ class CompletionRequest( BaseRequest ): return _ConvertCompletionResponseToVimDatas( JsonFromFuture( self._response_future ) ) except Exception as e: - vimsupport.PostVimMessage( str( e ) ) + HandleServerException( e ) return [] diff --git a/python/ycm/client/event_notification.py b/python/ycm/client/event_notification.py index a5978ad0..80eb04bd 100644 --- a/python/ycm/client/event_notification.py +++ b/python/ycm/client/event_notification.py @@ -20,7 +20,7 @@ from ycm import vimsupport from ycmd.responses import UnknownExtraConf from ycm.client.base_request import ( BaseRequest, BuildRequestData, - JsonFromFuture ) + JsonFromFuture, HandleServerException ) class EventNotification( BaseRequest ): @@ -61,7 +61,7 @@ class EventNotification( BaseRequest ): else: _IgnoreExtraConfFile( e.extra_conf_file ) except Exception as e: - vimsupport.PostVimMessage( str( e ) ) + HandleServerException( e ) return self._cached_response if self._cached_response else []