Commit 887fdf6f authored by Ilias Tsitsimpis's avatar Ilias Tsitsimpis
Browse files

snf-django-lib: Fault Exceptions now have code attr

parent 564eb947
......@@ -40,11 +40,13 @@ def camel_case(s):
class Fault(Exception):
def __init__(self, message='', details='', name=''):
Exception.__init__(self, message, details, name)
def __init__(self, message='', details='', name='', code=None):
self.message = message
self.details = details
if not hasattr(self, 'code'):
self.code = code = name or camel_case(self.__class__.__name__)
Exception.__init__(self, message, details,, self.code)
# 2xx
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment