If errors are returned in addition to completion suggestions, print them
This commit is contained in:
parent
9430aee4b3
commit
258951ece4
@ -163,7 +163,7 @@ def JsonFromFuture( future ):
|
|||||||
response = future.result()
|
response = future.result()
|
||||||
_ValidateResponseObject( response )
|
_ValidateResponseObject( response )
|
||||||
if response.status_code == requests.codes.server_error:
|
if response.status_code == requests.codes.server_error:
|
||||||
_RaiseExceptionForData( response.json() )
|
raise MakeServerException( response.json() )
|
||||||
|
|
||||||
# We let Requests handle the other status types, we only handle the 500
|
# We let Requests handle the other status types, we only handle the 500
|
||||||
# error code.
|
# error code.
|
||||||
@ -218,10 +218,9 @@ def _CheckServerIsHealthyWithCache():
|
|||||||
except:
|
except:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def MakeServerException( data ):
|
||||||
def _RaiseExceptionForData( data ):
|
|
||||||
if data[ 'exception' ][ 'TYPE' ] == UnknownExtraConf.__name__:
|
if data[ 'exception' ][ 'TYPE' ] == UnknownExtraConf.__name__:
|
||||||
raise UnknownExtraConf( data[ 'exception' ][ 'extra_conf_file' ] )
|
return UnknownExtraConf( data[ 'exception' ][ 'extra_conf_file' ] )
|
||||||
|
|
||||||
raise ServerError( '{0}: {1}'.format( data[ 'exception' ][ 'TYPE' ],
|
return ServerError( '{0}: {1}'.format( data[ 'exception' ][ 'TYPE' ],
|
||||||
data[ 'message' ] ) )
|
data[ 'message' ] ) )
|
||||||
|
@ -19,7 +19,8 @@
|
|||||||
|
|
||||||
from ycmd.utils import ToUtf8IfNeeded
|
from ycmd.utils import ToUtf8IfNeeded
|
||||||
from ycm.client.base_request import ( BaseRequest, JsonFromFuture,
|
from ycm.client.base_request import ( BaseRequest, JsonFromFuture,
|
||||||
HandleServerException )
|
HandleServerException,
|
||||||
|
MakeServerException )
|
||||||
|
|
||||||
TIMEOUT_SECONDS = 0.5
|
TIMEOUT_SECONDS = 0.5
|
||||||
|
|
||||||
@ -43,10 +44,16 @@ class CompletionRequest( BaseRequest ):
|
|||||||
if not self._response_future:
|
if not self._response_future:
|
||||||
return []
|
return []
|
||||||
try:
|
try:
|
||||||
return _ConvertCompletionResponseToVimDatas(
|
response = JsonFromFuture( self._response_future )
|
||||||
JsonFromFuture( self._response_future ) )
|
|
||||||
|
errors = response['errors'] if 'errors' in response else []
|
||||||
|
for e in errors:
|
||||||
|
HandleServerException( MakeServerException( e ) )
|
||||||
|
|
||||||
|
return _ConvertCompletionResponseToVimDatas( response )
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
HandleServerException( e )
|
HandleServerException( e )
|
||||||
|
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user