summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2020-03-05 19:19:38 -0500
committerKevin Van Brunt <kmvanbrunt@gmail.com>2020-03-05 19:19:38 -0500
commitd17f79428a41a5239c4fdbdf9745c294649f49e8 (patch)
tree33a751c3200fefb57ab4b2721136b72d45296074
parent4ce15df09106b689a36479f1ffdec07838d8802d (diff)
downloadcmd2-git-d17f79428a41a5239c4fdbdf9745c294649f49e8.tar.gz
Changed name of exception class as requested in code review
-rw-r--r--cmd2/cmd2.py4
-rw-r--r--cmd2/decorators.py6
-rw-r--r--cmd2/exceptions.py4
3 files changed, 7 insertions, 7 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index acb0797a..65b35705 100644
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -50,7 +50,7 @@ from . import utils
from .argparse_custom import CompletionItem, DEFAULT_ARGUMENT_PARSER
from .clipboard import can_clip, get_paste_buffer, write_to_paste_buffer
from .decorators import with_argparser
-from .exceptions import CmdLineError, EmbeddedConsoleExit, EmptyStatement
+from .exceptions import Cmd2ArgparseException, EmbeddedConsoleExit, EmptyStatement
from .history import History, HistoryItem
from .parsing import StatementParser, Statement, Macro, MacroArg, shlex_split
from .rl_utils import rl_type, RlType, rl_get_point, rl_set_prompt, vt100_support, rl_make_safe_prompt, rl_warning
@@ -1683,7 +1683,7 @@ class Cmd(cmd.Cmd):
# Stop saving command's stdout before command finalization hooks run
self.stdout.pause_storage = True
- except (CmdLineError, EmptyStatement):
+ except (Cmd2ArgparseException, EmptyStatement):
# Don't do anything, but do allow command finalization hooks to run
pass
except Exception as ex:
diff --git a/cmd2/decorators.py b/cmd2/decorators.py
index 0e89fc7b..ee6d80f2 100644
--- a/cmd2/decorators.py
+++ b/cmd2/decorators.py
@@ -4,7 +4,7 @@ import argparse
from typing import Callable, List, Optional, Union
from . import constants
-from .exceptions import CmdLineError
+from .exceptions import Cmd2ArgparseException
from .parsing import Statement
@@ -145,7 +145,7 @@ def with_argparser_and_unknown_args(parser: argparse.ArgumentParser, *,
try:
args, unknown = parser.parse_known_args(parsed_arglist, namespace)
except SystemExit:
- raise CmdLineError
+ raise Cmd2ArgparseException
else:
setattr(args, '__statement__', statement)
return func(cmd2_app, args, unknown)
@@ -217,7 +217,7 @@ def with_argparser(parser: argparse.ArgumentParser, *,
try:
args = parser.parse_args(parsed_arglist, namespace)
except SystemExit:
- raise CmdLineError
+ raise Cmd2ArgparseException
else:
setattr(args, '__statement__', statement)
return func(cmd2_app, args)
diff --git a/cmd2/exceptions.py b/cmd2/exceptions.py
index 1c00794f..1fffed1c 100644
--- a/cmd2/exceptions.py
+++ b/cmd2/exceptions.py
@@ -2,8 +2,8 @@
"""Custom exceptions for cmd2. These are NOT part of the public API and are intended for internal use only."""
-class CmdLineError(Exception):
- """Custom class for when an error occurred parsing the command line"""
+class Cmd2ArgparseException(Exception):
+ """Custom exception class for when an argparse-decorated command has an error parsing its arguments"""
pass