Skip to content

Commit d17f794

Browse files
committed
Changed name of exception class as requested in code review
1 parent 4ce15df commit d17f794

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

cmd2/cmd2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
from .argparse_custom import CompletionItem, DEFAULT_ARGUMENT_PARSER
5151
from .clipboard import can_clip, get_paste_buffer, write_to_paste_buffer
5252
from .decorators import with_argparser
53-
from .exceptions import CmdLineError, EmbeddedConsoleExit, EmptyStatement
53+
from .exceptions import Cmd2ArgparseException, EmbeddedConsoleExit, EmptyStatement
5454
from .history import History, HistoryItem
5555
from .parsing import StatementParser, Statement, Macro, MacroArg, shlex_split
5656
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 @@ def onecmd_plus_hooks(self, line: str, *, add_to_history: bool = True, py_bridge
16831683
# Stop saving command's stdout before command finalization hooks run
16841684
self.stdout.pause_storage = True
16851685

1686-
except (CmdLineError, EmptyStatement):
1686+
except (Cmd2ArgparseException, EmptyStatement):
16871687
# Don't do anything, but do allow command finalization hooks to run
16881688
pass
16891689
except Exception as ex:

cmd2/decorators.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from typing import Callable, List, Optional, Union
55

66
from . import constants
7-
from .exceptions import CmdLineError
7+
from .exceptions import Cmd2ArgparseException
88
from .parsing import Statement
99

1010

@@ -145,7 +145,7 @@ def cmd_wrapper(cmd2_app, statement: Union[Statement, str]):
145145
try:
146146
args, unknown = parser.parse_known_args(parsed_arglist, namespace)
147147
except SystemExit:
148-
raise CmdLineError
148+
raise Cmd2ArgparseException
149149
else:
150150
setattr(args, '__statement__', statement)
151151
return func(cmd2_app, args, unknown)
@@ -217,7 +217,7 @@ def cmd_wrapper(cmd2_app, statement: Union[Statement, str]):
217217
try:
218218
args = parser.parse_args(parsed_arglist, namespace)
219219
except SystemExit:
220-
raise CmdLineError
220+
raise Cmd2ArgparseException
221221
else:
222222
setattr(args, '__statement__', statement)
223223
return func(cmd2_app, args)

cmd2/exceptions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"""Custom exceptions for cmd2. These are NOT part of the public API and are intended for internal use only."""
33

44

5-
class CmdLineError(Exception):
6-
"""Custom class for when an error occurred parsing the command line"""
5+
class Cmd2ArgparseException(Exception):
6+
"""Custom exception class for when an argparse-decorated command has an error parsing its arguments"""
77
pass
88

99

0 commit comments

Comments
 (0)