Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Partial fix to exception notification issue in VS #11

Merged
merged 1 commit into from
Jan 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,7 @@ ENV/

# mypy
.mypy_cache/

# vs code and vs
.vscode/
.vs/
33 changes: 28 additions & 5 deletions ptvsd/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,16 @@ def on_initialize(self, request, args):
supportsExceptionInfoRequest=True,
supportsConfigurationDoneRequest=True,
exceptionBreakpointFilters=[
{'filter': 'raised', 'label': 'Raised Exceptions'},
{'filter': 'uncaught', 'label': 'Uncaught Exceptions'},
{
'filter': 'raised',
'label': 'Raised Exceptions',
'default': 'true'
},
{
'filter': 'uncaught',
'label': 'Uncaught Exceptions',
'default': 'true'
},
],
)
self.send_event('initialized')
Expand Down Expand Up @@ -535,9 +543,24 @@ def on_setExceptionBreakpoints(self, request, args):
break_raised = 'raised' in filters
break_uncaught = 'uncaught' in filters
if break_raised or break_uncaught:
cmdargs = (2 if break_raised else 0,
1 if break_uncaught else 0,
0)
# notify_always options:
# 1 is deprecated, you will see a warning message
# 2 notify on first raise only
# 3 or greater, notify always
notify_always = 3 if break_raised else 0

# notify_on_terminate options:
# 1 notify on terminate
# Any other value do NOT notify on terminate
notify_on_terminate = 1 if break_uncaught else 0

# ignore_libraries options:
# Less than or equal to 0 DO NOT ignore libraries
# Greater than 0 ignore libraries
ignore_libraries = 1
cmdargs = (notify_always,
notify_on_terminate,
ignore_libraries)
msg = 'python-BaseException\t{}\t{}\t{}'.format(*cmdargs)
self.pydevd_notify(pydevd_comm.CMD_ADD_EXCEPTION_BREAK, msg)
self.send_response(request)
Expand Down