From 8af4942857cb8eb906056df4c4ae7ffefe9e229c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Tue, 13 Apr 2010 21:21:56 +0200 Subject: Better eix error inheritance and handling --- portato/eix/exceptions.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'portato') diff --git a/portato/eix/exceptions.py b/portato/eix/exceptions.py index 1ca05e1..cc4665d 100644 --- a/portato/eix/exceptions.py +++ b/portato/eix/exceptions.py @@ -23,7 +23,14 @@ class EixError (Exception): :ivar message: The error message """ + message = _("Unknown error.") + + def __init__ (self, msg = None): + Exception.__init__(self) + + if msg: + self.message = msg def __str__ (self): return self.message @@ -34,7 +41,7 @@ class EndOfFileException (EixError): """ def __init__ (self, filename): - self.message = _("End of file reached though it was not expected: '%s'") % filename + EixError.__init__(self, _("End of file reached though it was not expected: '%s'") % filename) class UnsupportedVersionError (EixError): """ @@ -42,4 +49,4 @@ class UnsupportedVersionError (EixError): """ def __init__ (self, version): - self.message = _("Version '%s' is not supported.") % version + EixError.__init__(self, _("Version '%s' is not supported.") % version) -- cgit v1.2.3