Support multiline exception message
Also stopped adding the "ycmd exception:" prefix to error messages because it lies; some exceptions hitting this may not come from ycmd.
This commit is contained in:
parent
f981370965
commit
0ed1096040
@ -42,7 +42,6 @@ _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 ):
|
||||||
@ -191,7 +190,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( YCMD_ERROR_PREFIX + serialized_exception )
|
vimsupport.PostMultiLineNotice( serialized_exception )
|
||||||
|
|
||||||
|
|
||||||
def _ToUtf8Json( data ):
|
def _ToUtf8Json( data ):
|
||||||
|
@ -30,7 +30,6 @@ 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, ServerError )
|
UnknownExtraConf, ServerError )
|
||||||
@ -60,6 +59,14 @@ def PostVimMessage_Call( message ):
|
|||||||
'\' | echohl None' )
|
'\' | echohl None' )
|
||||||
|
|
||||||
|
|
||||||
|
def PostMultiLineNotice_Call( message ):
|
||||||
|
"""Return a mock.call object for a call to vimsupport.PostMultiLineNotice with
|
||||||
|
the supplied message"""
|
||||||
|
return call( 'echohl WarningMsg | echo \''
|
||||||
|
+ message +
|
||||||
|
'\' | echohl None' )
|
||||||
|
|
||||||
|
|
||||||
def PresentDialog_Confirm_Call( message ):
|
def PresentDialog_Confirm_Call( message ):
|
||||||
"""Return a mock.call object for a call to vimsupport.PresentDialog, as called
|
"""Return a mock.call object for a call to vimsupport.PresentDialog, as called
|
||||||
why vimsupport.Confirm with the supplied confirmation message"""
|
why vimsupport.Confirm with the supplied confirmation message"""
|
||||||
@ -193,13 +200,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( YCMD_ERROR_PREFIX + ERROR_TEXT ),
|
PostMultiLineNotice_Call( 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( YCMD_ERROR_PREFIX + ERROR_TEXT ),
|
PostMultiLineNotice_Call( ERROR_TEXT ),
|
||||||
] )
|
] )
|
||||||
|
|
||||||
# But it does if a subsequent event raises again
|
# But it does if a subsequent event raises again
|
||||||
@ -207,8 +214,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( YCMD_ERROR_PREFIX + ERROR_TEXT ),
|
PostMultiLineNotice_Call( ERROR_TEXT ),
|
||||||
PostVimMessage_Call( YCMD_ERROR_PREFIX + ERROR_TEXT ),
|
PostMultiLineNotice_Call( ERROR_TEXT ),
|
||||||
] )
|
] )
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user