Catch adapter being None and print user-friendly message:

This commit is contained in:
Ben Jackson 2020-03-08 18:18:29 +00:00
commit 1b7402915c
2 changed files with 12 additions and 2 deletions

View file

@ -136,7 +136,17 @@ class DebugSession( object ):
configuration = configurations[ configuration_name ] configuration = configurations[ configuration_name ]
adapter = configuration.get( 'adapter' ) adapter = configuration.get( 'adapter' )
if isinstance( adapter, str ): if isinstance( adapter, str ):
adapter = adapters.get( adapter ) adapter_dict = adapters.get( adapter )
if adapter_dict is None:
utils.UserMessage( f"The specified adapter '{adapter}' is not "
"available. Did you forget to run "
"'install_gadget.py'?",
persist = True,
error = True )
return
adapter = adapter_dict
# TODO: Do we want some form of persistence ? e.g. self._staticVariables, # TODO: Do we want some form of persistence ? e.g. self._staticVariables,
# set from an api call like SetLaunchParam( 'var', 'value' ), perhaps also a # set from an api call like SetLaunchParam( 'var', 'value' ), perhaps also a

View file

@ -18,7 +18,7 @@
} }
}, },
"attach": { "attach": {
"adapter": "vscode-python", "adapter": "debugpy",
"configuration": { "configuration": {
"request": "attach", "request": "attach",
"type": "python", "type": "python",