jhgdZddlmZGddeZGddeZGddeZGd d eZGd d eZGd deZ Gdde Z GddeZ GddeZ dS)zCustom exceptions for cmd2)AnyceZdZdZdS)SkipPostcommandHooksz Custom exception class for when a command has a failure bad enough to skip post command hooks, but not bad enough to print the exception to the user. N__name__ __module__ __qualname____doc___/home/jenkins/workspace/simtester-sanitize/venv/lib/python3.11/site-packages/cmd2/exceptions.pyrr   Dr rceZdZdZdS)Cmd2ArgparseErroraj A ``SkipPostcommandHooks`` exception for when a command fails to parse its arguments. Normally argparse raises a SystemExit exception in these cases. To avoid stopping the command loop, catch the SystemExit and raise this instead. If you still need to run post command hooks after parsing fails, just return instead of raising an exception. Nrr r r rrs Dr rceZdZdZdS)CommandSetRegistrationErrorz Exception that can be thrown when an error occurs while a CommandSet is being added or removed from a cmd2 application. Nrr r r rr!rr rc6eZdZdZdddededdffdZxZS) CompletionErrora* Raised during tab completion operations to report any sort of error you want printed. This can also be used just to display a message, even if it's not an error. For instance, ArgparseCompleter raises CompletionErrors to display tab completion hints and sets apply_style to False so hints aren't colored like error text. Example use cases - Reading a database to retrieve a tab completion data set failed - A previous command line argument that determines the data set being completed is invalid - Tab completion hints T) apply_styleargsrreturnNcB||_tj|dS)a4 Initializer for CompletionError :param apply_style: If True, then ansi.style_error will be applied to the message text when printed. Set to False in cases where the message text already has the desired style. Defaults to True. N)rsuper__init__)selfrr __class__s r rzCompletionError.__init__7s''$r )rrr r rboolr __classcell__rs@r rr*sk  8<    c               r rc0eZdZdZdededdffd ZxZS)PassThroughExceptionz 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. r wrapped_exrNcB||_tj|dS)zs Initializer for PassThroughException :param wrapped_ex: the exception that will be raised N)r"rr)rr"rrs r rzPassThroughException.__init__Is& %$r )rrr r r BaseExceptionrrrs@r r!r!Cs\  c }           r r!ceZdZdZdS)Cmd2ShlexErrorzIRaised when shlex fails to parse a command line string in StatementParserNrr r r r&r&WsSSDr r&ceZdZdZdS)EmbeddedConsoleExitz3Custom exception class for use with the py command.Nrr r r r(r(]s==Dr r(ceZdZdZdS)EmptyStatementzPCustom exception class for handling behavior when the user just presses .Nrr r r r*r*csZZDr r*ceZdZdZdS)RedirectionErrorzBCustom exception class for when redirecting or piping output failsNrr r r r,r,isLLDr r,N)r typingr Exceptionrrrrr!r& SystemExitr(r*r,r r r r0s      9        ,        )        i   2      9    (     Y        *        Y        y     r