From f5594dd489317dc406d20f897fc720e0cf89c9d2 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Thu, 13 Nov 2008 23:29:35 -0700 Subject: Started work on cleaning up how exceptions are caught and sys.exit() is called in ipalib.cli.CLI --- ipalib/errors.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'ipalib/errors.py') diff --git a/ipalib/errors.py b/ipalib/errors.py index c2d83e73..71a837e9 100644 --- a/ipalib/errors.py +++ b/ipalib/errors.py @@ -98,6 +98,7 @@ class IPAError(StandardError): """ format = None + faultCode = 1 def __init__(self, *args): self.args = args @@ -109,6 +110,16 @@ class IPAError(StandardError): return self.format % self.args +class InvocationError(IPAError): + pass + +class UnknownCommandError(InvocationError): + format = 'unknown command "%s"' + +class UnknownHelpError(InvocationError): + format = 'no command nor topic "%s"' + + class ArgumentError(IPAError): """ Raised when a command is called with wrong number of arguments. -- cgit