-
Notifications
You must be signed in to change notification settings - Fork 190
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
I'm not really sure if this is a bug or a feature request or if this should be raised in vscode-python instead but it appears related to #391
Environment data
- debugpy version: 1.6.3
- OS and version: Windows 10
- Python version (& distribution if applicable, e.g. Anaconda): Python 3.10
- Using VS Code or Visual Studio: VS Code
Actual behavior
When a chained exception is caught it doesn't show the cause message, even though it shows the stack trace and says it was the cause.
Expected behavior
I think it should show:
- The cause message
- The cause stack trace
-
The above exception was the direct cause of the following exception:
- The message
- The stack trace
Alternatively 1 and 2 could be swapped as well as 4 and 5 swapped which would match what I see in the output:
Traceback (most recent call last):
File "c:\Users\james.duley\dev\design-library-2\py-lib\src\holmes_design\junk.py", line 3, in <module>
print(empty_dict["key"])
KeyError: 'key'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\james.duley\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None,
File "C:\Users\james.duley\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "c:\Users\james.duley\.vscode\extensions\ms-python.python-2022.13.12301015\pythonFiles\lib\python\debugpy\__main__.py", line 39, in <module>
cli.main()
File "c:\Users\james.duley\.vscode\extensions\ms-python.python-2022.13.12301015\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 430, in main
run()
File "c:\Users\james.duley\.vscode\extensions\ms-python.python-2022.13.12301015\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 284, in run_file
runpy.run_path(target, run_name="__main__")
File "c:\Users\james.duley\.vscode\extensions\ms-python.python-2022.13.12301015\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 321, in run_path
return _run_module_code(code, init_globals, run_name,
File "c:\Users\james.duley\.vscode\extensions\ms-python.python-2022.13.12301015\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 135, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "c:\Users\james.duley\.vscode\extensions\ms-python.python-2022.13.12301015\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 124, in _run_code
exec(code, run_globals)
File "c:\Users\james.duley\dev\design-library-2\py-lib\src\holmes_design\junk.py", line 5, in <module>
raise Exception("Something went wrong") from e
Exception: Something went wrong
Steps to reproduce:
- Run this code in debug mode in VS Code with "Uncaught Exceptions" breakpoint enabled
empty_dict = {}
try:
print(empty_dict["key"])
except KeyError as e:
raise Exception("Something went wrong") from e
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
