summaryrefslogtreecommitdiff
path: root/cmd2/exceptions.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2020-03-13 08:10:51 -0400
committerGitHub <noreply@github.com>2020-03-13 08:10:51 -0400
commit77e2a0fab7620d22e0fde6be7374dbbf26706fd4 (patch)
tree7596897fa233204b7c7b84c94f26c71ccaf5ad5b /cmd2/exceptions.py
parent59739aa5b6f253814fb019a9e777056a6efb61ca (diff)
parenta4160cfe9ab39402511c1a445f3b978099743bc9 (diff)
downloadcmd2-git-77e2a0fab7620d22e0fde6be7374dbbf26706fd4.tar.gz
Merge pull request #906 from python-cmd2/parsing_exception
Parsing exception
Diffstat (limited to 'cmd2/exceptions.py')
-rw-r--r--cmd2/exceptions.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/cmd2/exceptions.py b/cmd2/exceptions.py
index 747e2368..15787177 100644
--- a/cmd2/exceptions.py
+++ b/cmd2/exceptions.py
@@ -2,6 +2,20 @@
"""Custom exceptions for cmd2. These are NOT part of the public API and are intended for internal use only."""
+class Cmd2ArgparseError(Exception):
+ """
+ Custom exception class for when a command has an error parsing its arguments.
+ This can be raised by argparse decorators or the command functions themselves.
+ The main use of this exception is to tell cmd2 not to run Postcommand hooks.
+ """
+ pass
+
+
+class Cmd2ShlexError(Exception):
+ """Raised when shlex fails to parse a command line string in StatementParser"""
+ pass
+
+
class EmbeddedConsoleExit(SystemExit):
"""Custom exception class for use with the py command."""
pass