summaryrefslogtreecommitdiff
path: root/cmd2/exceptions.py
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2021-03-02 13:54:34 -0500
committerKevin Van Brunt <kmvanbrunt@gmail.com>2021-03-02 13:54:34 -0500
commit3f0f277c412fb4adf27710c1dcb10ce82dacd604 (patch)
tree3589fda03daebcc5aed0dbc07841563b37ba3ad2 /cmd2/exceptions.py
parent6b00402e82d09b4d8e0ed42662555b78edb47585 (diff)
parent4da77c4cb0756191ee13f3c0003a2b04863b73ae (diff)
downloadcmd2-git-3f0f277c412fb4adf27710c1dcb10ce82dacd604.tar.gz
Merge branch 'master' into history_fix
Diffstat (limited to 'cmd2/exceptions.py')
-rw-r--r--cmd2/exceptions.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/cmd2/exceptions.py b/cmd2/exceptions.py
index 39b7e333..b45167d1 100644
--- a/cmd2/exceptions.py
+++ b/cmd2/exceptions.py
@@ -62,6 +62,21 @@ class CompletionError(Exception):
super().__init__(*args)
+class PassThroughException(Exception):
+ """
+ Normally all unhandled exceptions raised during commands get printed to the user.
+ This class is used to wrap an exception that should be raised instead of printed.
+ """
+
+ def __init__(self, *args, wrapped_ex: BaseException):
+ """
+ Initializer for PassThroughException
+ :param wrapped_ex: the exception that will be raised
+ """
+ self.wrapped_ex = wrapped_ex
+ super().__init__(*args)
+
+
############################################################################################################
# The following exceptions are NOT part of the public API and are intended for internal use only.
############################################################################################################