summaryrefslogtreecommitdiff
path: root/talermerchantdemos/httpcommon/__init__.py
diff options
context:
space:
mode:
authorMS <ms@taler.net>2021-05-11 09:12:54 +0200
committerMS <ms@taler.net>2021-05-11 09:12:54 +0200
commit3f4952f15ede6fe3529f093ec4c188c0455f1d6d (patch)
tree62f1e13d51d4b7ab3981a6bfba4ae7edcb31c575 /talermerchantdemos/httpcommon/__init__.py
parent9b04aae3a58f0512277647c59ff99e34cb6a8b30 (diff)
downloadtaler-merchant-demos-3f4952f15ede6fe3529f093ec4c188c0455f1d6d.tar.gz
taler-merchant-demos-3f4952f15ede6fe3529f093ec4c188c0455f1d6d.tar.bz2
taler-merchant-demos-3f4952f15ede6fe3529f093ec4c188c0455f1d6d.zip
debug
Diffstat (limited to 'talermerchantdemos/httpcommon/__init__.py')
-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: