diff --git a/doc/build/html/_modules/accounting/decorators.html b/doc/build/html/_modules/accounting/decorators.html new file mode 100644 index 0000000000000000000000000000000000000000..ffe701bd457dcfb71cf89b3d3d7bf4c6853f3a27 --- /dev/null +++ b/doc/build/html/_modules/accounting/decorators.html @@ -0,0 +1,114 @@ + + + + +
+ + +
+from functools import wraps
+
+from flask import jsonify
+
+from accounting.exceptions import AccountingException
+
+
+[docs]def jsonify_exceptions(func):
+ '''
+ Wraps a Flask endpoint and catches any AccountingException-based
+ exceptions which are returned to the client as JSON.
+ '''
+ @wraps(func)
+ def wrapper(*args, **kw):
+ try:
+ return func(*args, **kw)
+ except AccountingException as exc:
+ return jsonify(error=exc)
+
+ return wrapper
+