Skip to content

Commit 27f9160

Browse files
committed
Add PASSTHROUGH_EXCEPTIONS
PASSTHROUGH_EXCEPTIONS allows other debuggers which use this as a codebase, e.g. the Mathics3 debugger, to register additional exceptions that can be raised.
1 parent dc96707 commit 27f9160

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

trepan/processor/cmdproc.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
# Note: the module name pre 3.2 is repr
2929
from reprlib import Repr
30-
from typing import Optional, Tuple
30+
from typing import Optional, Set, Tuple
3131

3232
import pyficache
3333
from pygments.console import colorize
@@ -44,10 +44,9 @@
4444
from trepan.processor.print import print_location
4545
from trepan.vprocessor import Processor
4646

47-
48-
def get_srcdir() -> str:
49-
filename = osp.normcase(osp.dirname(osp.abspath(__file__)))
50-
return osp.realpath(filename)
47+
# PASSTHROUGH_EXCEPTIONS allows other debuggers which use this as a codebase, e.g.
48+
# the Mathics3 debugger, to register additional exceptions that can be raised.
49+
PASSTHROUGH_EXCEPTIONS: Set = set()
5150

5251

5352
# arg_split culled from ipython's routine
@@ -699,8 +698,9 @@ def process_command(self):
699698
):
700699
# Let these exceptions propagate through
701700
raise
702-
except Exception:
703-
self.errmsg("INTERNAL ERROR: " + traceback.format_exc())
701+
except Exception as e:
702+
if e.__class__ in PASSTHROUGH_EXCEPTIONS:
703+
self.errmsg("INTERNAL ERROR: " + traceback.format_exc())
704704
pass
705705
pass
706706
pass

0 commit comments

Comments
 (0)