2013-12-17 14:41:30 +00:00
|
|
|
# Part of accounting-api project:
|
|
|
|
# https://gitorious.org/conservancy/accounting-api
|
|
|
|
# License: AGPLv3-or-later
|
|
|
|
|
2013-12-10 23:25:16 +00:00
|
|
|
class AccountingException(Exception):
|
|
|
|
'''
|
|
|
|
Used as a base for exceptions that are returned to the caller via the
|
|
|
|
jsonify_exceptions decorator
|
|
|
|
'''
|
2013-12-26 20:48:45 +00:00
|
|
|
http_code = 500
|
2013-12-20 23:24:37 +00:00
|
|
|
def __init__(self, message, **kw):
|
|
|
|
self.message = message
|
|
|
|
for key, value in kw.items():
|
|
|
|
setattr(self, key, value)
|
|
|
|
|
|
|
|
|
|
|
|
class TransactionNotFound(AccountingException):
|
2013-12-26 20:48:45 +00:00
|
|
|
http_code = 404
|
2013-12-26 19:44:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
class LedgerNotBalanced(AccountingException):
|
2013-12-26 20:48:45 +00:00
|
|
|
http_code = 400
|
2013-12-26 19:44:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
class TransactionIDCollision(AccountingException):
|
2013-12-26 20:48:45 +00:00
|
|
|
http_code = 400
|