diff --git a/python/ycm/client/base_request.py b/python/ycm/client/base_request.py index 2da9dd9c..7afc4052 100644 --- a/python/ycm/client/base_request.py +++ b/python/ycm/client/base_request.py @@ -42,6 +42,8 @@ _EXECUTOR = UnsafeThreadPoolExecutor( max_workers = 30 ) _DEFAULT_TIMEOUT_SEC = 30 _HMAC_HEADER = 'x-ycm-hmac' +YCMD_ERROR_PREFIX = 'ycmd exception: ' + class BaseRequest( object ): def __init__( self ): pass @@ -189,7 +191,7 @@ def HandleServerException( exception ): # up often and isn't something that's actionable by the user. if 'already being parsed' in serialized_exception: return - vimsupport.PostVimMessage( serialized_exception ) + vimsupport.PostVimMessage( YCMD_ERROR_PREFIX + serialized_exception ) def _ToUtf8Json( data ): diff --git a/python/ycm/tests/event_notification_test.py b/python/ycm/tests/event_notification_test.py index 328c629e..2bebd069 100644 --- a/python/ycm/tests/event_notification_test.py +++ b/python/ycm/tests/event_notification_test.py @@ -30,6 +30,7 @@ import contextlib import os from ycm.youcompleteme import YouCompleteMe +from ycm.client.base_request import YCMD_ERROR_PREFIX from ycmd import user_options_store from ycmd.responses import ( BuildDiagnosticData, Diagnostic, Location, Range, UnknownExtraConf ) @@ -192,13 +193,13 @@ class EventNotification_test( object ): # The first call raises a warning vim_command.assert_has_exact_calls( [ - PostVimMessage_Call( ERROR_TEXT ), + PostVimMessage_Call( YCMD_ERROR_PREFIX + ERROR_TEXT ), ] ) # Subsequent calls don't re-raise the warning self.server_state.HandleFileParseRequest() vim_command.assert_has_exact_calls( [ - PostVimMessage_Call( ERROR_TEXT ), + PostVimMessage_Call( YCMD_ERROR_PREFIX + ERROR_TEXT ), ] ) # But it does if a subsequent event raises again @@ -206,8 +207,8 @@ class EventNotification_test( object ): assert self.server_state.FileParseRequestReady() self.server_state.HandleFileParseRequest() vim_command.assert_has_exact_calls( [ - PostVimMessage_Call( ERROR_TEXT ), - PostVimMessage_Call( ERROR_TEXT ), + PostVimMessage_Call( YCMD_ERROR_PREFIX + ERROR_TEXT ), + PostVimMessage_Call( YCMD_ERROR_PREFIX + ERROR_TEXT ), ] )