Don't crash if the custom handler can't be loaded
This commit is contained in:
parent
7a8f479f66
commit
f003d66d35
1 changed files with 7 additions and 4 deletions
|
|
@ -897,6 +897,7 @@ class DebugSession( object ):
|
||||||
self._splash_screen,
|
self._splash_screen,
|
||||||
"Unable to start adapter" )
|
"Unable to start adapter" )
|
||||||
else:
|
else:
|
||||||
|
handlers = [ self ]
|
||||||
if 'custom_handler' in self._adapter:
|
if 'custom_handler' in self._adapter:
|
||||||
spec = self._adapter[ 'custom_handler' ]
|
spec = self._adapter[ 'custom_handler' ]
|
||||||
if isinstance( spec, dict ):
|
if isinstance( spec, dict ):
|
||||||
|
|
@ -905,10 +906,12 @@ class DebugSession( object ):
|
||||||
else:
|
else:
|
||||||
module, cls = spec.rsplit( '.', 1 )
|
module, cls = spec.rsplit( '.', 1 )
|
||||||
|
|
||||||
CustomHandler = getattr( importlib.import_module( module ), cls )
|
try:
|
||||||
handlers = [ CustomHandler( self ), self ]
|
CustomHandler = getattr( importlib.import_module( module ), cls )
|
||||||
else:
|
handlers = [ CustomHandler( self ), self ]
|
||||||
handlers = [ self ]
|
except ImportError:
|
||||||
|
self._logger.exception( "Unable to load custom adapter %s",
|
||||||
|
spec )
|
||||||
|
|
||||||
self._connection = debug_adapter_connection.DebugAdapterConnection(
|
self._connection = debug_adapter_connection.DebugAdapterConnection(
|
||||||
handlers,
|
handlers,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue