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
|
||||
_HMAC_HEADER = 'x-ycm-hmac'
|
||||
|
||||
YCMD_ERROR_PREFIX = 'ycmd exception: '
|
||||
|
||||
class BaseRequest( object ):
|
||||
def __init__( self ):
|
||||
@ -191,7 +190,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( YCMD_ERROR_PREFIX + serialized_exception )
|
||||
vimsupport.PostMultiLineNotice( serialized_exception )
|
||||
|
||||
|
||||
def _ToUtf8Json( data ):
|
||||
|
@ -30,7 +30,6 @@ 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, ServerError )
|
||||
@ -60,6 +59,14 @@ def PostVimMessage_Call( message ):
|
||||
'\' | 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 ):
|
||||
"""Return a mock.call object for a call to vimsupport.PresentDialog, as called
|
||||
why vimsupport.Confirm with the supplied confirmation message"""
|
||||
@ -193,13 +200,13 @@ class EventNotification_test( object ):
|
||||
|
||||
# The first call raises a warning
|
||||
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
|
||||
self.server_state.HandleFileParseRequest()
|
||||
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
|
||||
@ -207,8 +214,8 @@ class EventNotification_test( object ):
|
||||
assert self.server_state.FileParseRequestReady()
|
||||
self.server_state.HandleFileParseRequest()
|
||||
vim_command.assert_has_exact_calls( [
|
||||
PostVimMessage_Call( YCMD_ERROR_PREFIX + ERROR_TEXT ),
|
||||
PostVimMessage_Call( YCMD_ERROR_PREFIX + ERROR_TEXT ),
|
||||
PostMultiLineNotice_Call( ERROR_TEXT ),
|
||||
PostMultiLineNotice_Call( ERROR_TEXT ),
|
||||
] )
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user