X-Git-Url: https://code.grnet.gr/git/ganeti-local/blobdiff_plain/4b63dc7a96890c0a32f218d98b8162cbc7dacd98..fb2865ae4e5162e7dc9bffd9975073d94fda8de8:/lib/errors.py?ds=sidebyside diff --git a/lib/errors.py b/lib/errors.py index ee660c2..1812886 100644 --- a/lib/errors.py +++ b/lib/errors.py @@ -43,6 +43,19 @@ ECODE_FAULT = "internal_error" # environment error (e.g. node disk error) ECODE_ENVIRON = "environment_error" +#: List of all failure types +ECODE_ALL = frozenset([ + ECODE_RESOLVER, + ECODE_NORES, + ECODE_INVAL, + ECODE_STATE, + ECODE_NOENT, + ECODE_EXISTS, + ECODE_NOTUNIQUE, + ECODE_FAULT, + ECODE_ENVIRON, + ]) + class GenericError(Exception): """Base exception for Ganeti. @@ -176,6 +189,12 @@ class OpExecError(GenericError): """ +class OpResultError(GenericError): + """Issue with OpCode result. + + """ + + class OpCodeUnknown(GenericError): """Unknown opcode submitted. @@ -285,7 +304,7 @@ class InotifyError(GenericError): class QuitGanetiException(Exception): - """Signal that Ganeti that it must quit. + """Signal Ganeti that it must quit. This is not necessarily an error (and thus not a subclass of GenericError), but it's an exceptional circumstance and it is thus @@ -372,6 +391,30 @@ class IPAddressError(GenericError): """ +class LuxiError(GenericError): + """LUXI error. + + """ + + +class QueryFilterParseError(ParseError): + """Error while parsing query filter. + + """ + def GetDetails(self): + """Returns a list of strings with details about the error. + + """ + try: + (_, inner) = self.args + except IndexError: + return None + + return [str(inner.line), + (" " * (inner.column - 1)) + "^", + str(inner)] + + # errors should be added above @@ -439,4 +482,4 @@ def MaybeRaise(result): error = GetEncodedError(result) if error: (errcls, args) = error - raise errcls, args + raise errcls(args)