Making it clearer an exception came from ycmd
Makes debugging easier when you know where the error lies.
This commit is contained in:
parent
b04870c824
commit
1e72f4d421
@ -42,6 +42,8 @@ _EXECUTOR = UnsafeThreadPoolExecutor( max_workers = 30 )
|
|||||||
_DEFAULT_TIMEOUT_SEC = 30
|
_DEFAULT_TIMEOUT_SEC = 30
|
||||||
_HMAC_HEADER = 'x-ycm-hmac'
|
_HMAC_HEADER = 'x-ycm-hmac'
|
||||||
|
|
||||||
|
YCMD_ERROR_PREFIX = 'ycmd exception: '
|
||||||
|
|
||||||
class BaseRequest( object ):
|
class BaseRequest( object ):
|
||||||
def __init__( self ):
|
def __init__( self ):
|
||||||
pass
|
pass
|
||||||
@ -189,7 +191,7 @@ def HandleServerException( exception ):
|
|||||||
# up often and isn't something that's actionable by the user.
|
# up often and isn't something that's actionable by the user.
|
||||||
if 'already being parsed' in serialized_exception:
|
if 'already being parsed' in serialized_exception:
|
||||||
return
|
return
|
||||||
vimsupport.PostVimMessage( serialized_exception )
|
vimsupport.PostVimMessage( YCMD_ERROR_PREFIX + serialized_exception )
|
||||||
|
|
||||||
|
|
||||||
def _ToUtf8Json( data ):
|
def _ToUtf8Json( data ):
|
||||||
|
@ -30,6 +30,7 @@ import contextlib
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
from ycm.youcompleteme import YouCompleteMe
|
from ycm.youcompleteme import YouCompleteMe
|
||||||
|
from ycm.client.base_request import YCMD_ERROR_PREFIX
|
||||||
from ycmd import user_options_store
|
from ycmd import user_options_store
|
||||||
from ycmd.responses import ( BuildDiagnosticData, Diagnostic, Location, Range,
|
from ycmd.responses import ( BuildDiagnosticData, Diagnostic, Location, Range,
|
||||||
UnknownExtraConf )
|
UnknownExtraConf )
|
||||||
@ -192,13 +193,13 @@ class EventNotification_test( object ):
|
|||||||
|
|
||||||
# The first call raises a warning
|
# The first call raises a warning
|
||||||
vim_command.assert_has_exact_calls( [
|
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
|
# Subsequent calls don't re-raise the warning
|
||||||
self.server_state.HandleFileParseRequest()
|
self.server_state.HandleFileParseRequest()
|
||||||
vim_command.assert_has_exact_calls( [
|
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
|
# But it does if a subsequent event raises again
|
||||||
@ -206,8 +207,8 @@ class EventNotification_test( object ):
|
|||||||
assert self.server_state.FileParseRequestReady()
|
assert self.server_state.FileParseRequestReady()
|
||||||
self.server_state.HandleFileParseRequest()
|
self.server_state.HandleFileParseRequest()
|
||||||
vim_command.assert_has_exact_calls( [
|
vim_command.assert_has_exact_calls( [
|
||||||
PostVimMessage_Call( ERROR_TEXT ),
|
PostVimMessage_Call( YCMD_ERROR_PREFIX + ERROR_TEXT ),
|
||||||
PostVimMessage_Call( ERROR_TEXT ),
|
PostVimMessage_Call( YCMD_ERROR_PREFIX + ERROR_TEXT ),
|
||||||
] )
|
] )
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user