summaryrefslogtreecommitdiff
path: root/talermerchantdemos
diff options
context:
space:
mode:
Diffstat (limited to 'talermerchantdemos')
-rw-r--r--talermerchantdemos/httpcommon/__init__.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/talermerchantdemos/httpcommon/__init__.py b/talermerchantdemos/httpcommon/__init__.py
index 894cd7a..8546ff0 100644
--- a/talermerchantdemos/httpcommon/__init__.py
+++ b/talermerchantdemos/httpcommon/__init__.py
@@ -7,7 +7,9 @@ import time
from flask_babel import gettext
import os
import re
+import logging
+LOGGER = logging.getLogger(__name__)
class BackendException(Exception):
"""Exception for failed communication with the Taler merchant backend"""
@@ -17,6 +19,12 @@ class BackendException(Exception):
self.backend_status = backend_status
self.backend_json = backend_json
+def exception_handler(func):
+ def inner(*args, **kwargs):
+ try:
+ func(*args, **kwargs)
+ except BackendException as err:
+ LOGGER.error(err.backend_json)
##
# POST a request to the backend, and return a error
@@ -26,6 +34,7 @@ class BackendException(Exception):
# this request.
# @param json the POST's body.
# @return the backend response (JSON format).
+@exception_handler
def backend_post(backend_url, endpoint, json, auth_token=None):
headers = dict()
if auth_token is not None: