From 2d458a12339fbb7ef006ff7defc1e2f541e2f23f Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Mon, 24 Nov 2008 21:34:01 -0700 Subject: Stared some RPC-related error cleanup; started work on ipa_server.rcp.xmlrpc plugin --- ipalib/errors.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'ipalib/errors.py') diff --git a/ipalib/errors.py b/ipalib/errors.py index 71a837e9c..a01082504 100644 --- a/ipalib/errors.py +++ b/ipalib/errors.py @@ -113,9 +113,33 @@ class IPAError(StandardError): class InvocationError(IPAError): pass + class UnknownCommandError(InvocationError): format = 'unknown command "%s"' +def _(text): + return text + + +class HandledError(StandardError): + """ + Base class for errors that can be raised across a remote procecdure call. + """ + def __init__(self, message=None, **kw): + self.kw = kw + if message is None: + message = self.format % kw + StandardError.__init__(self, message) + + +class CommandError(HandledError): + format = _('Unknown command %(name)r') + + +class RemoteCommandError(HandledError): + format = 'Server at %(uri)r has no command %(command)r' + + class UnknownHelpError(InvocationError): format = 'no command nor topic "%s"' -- cgit