experimental-accounting-api/accounting/exceptions.py
Joar Wandborg 281d6fed47 [test] Added unit tests
- Moved the TransactionNotFound exception to a more appropriate place.
- Changed the serialization for AccountingExceptions
- Override the Exception.__init__ method in AccountingException
- Added __eq__ methods to accounting.models.*
- Catch the TransactionNotFound exception in transaction_get and return a
  404 instead. This could be improved, perhaps in the jsonify_exceptions
  decorator so that all endpoints that raise a TransactionNotFound
  exception automatically return a 404.
2013-12-21 00:24:37 +01:00

17 lines
479 B
Python

# Part of accounting-api project:
# https://gitorious.org/conservancy/accounting-api
# License: AGPLv3-or-later
class AccountingException(Exception):
'''
Used as a base for exceptions that are returned to the caller via the
jsonify_exceptions decorator
'''
def __init__(self, message, **kw):
self.message = message
for key, value in kw.items():
setattr(self, key, value)
class TransactionNotFound(AccountingException):
pass