Commit 68533e15 by Kálmán Viktor

dashboard: add logging to failed requests in store

parent b8d089c1
from django.http import Http404 from django.http import Http404
import json import json
import logging
import requests import requests
from datetime import datetime from datetime import datetime
...@@ -7,6 +8,8 @@ from sizefield.utils import filesizeformat ...@@ -7,6 +8,8 @@ from sizefield.utils import filesizeformat
from django.conf import settings from django.conf import settings
logger = logging.getLogger(__name__)
class Mock(object): class Mock(object):
pass pass
...@@ -42,7 +45,8 @@ def post_request(url, payload, timeout=None): ...@@ -42,7 +45,8 @@ def post_request(url, payload, timeout=None):
**get_request_arguments(settings.STORE_SSL_AUTH, **get_request_arguments(settings.STORE_SSL_AUTH,
settings.STORE_BASIC_AUTH)) settings.STORE_BASIC_AUTH))
return r return r
except Exception: except Exception as e:
logger.error("Error in store POST: %s" % e)
dummy = Mock() dummy = Mock()
setattr(dummy, "status_code", 200) setattr(dummy, "status_code", 200)
setattr(dummy, "content", "[]") setattr(dummy, "content", "[]")
...@@ -56,7 +60,8 @@ def get_request(url, timeout=None): ...@@ -56,7 +60,8 @@ def get_request(url, timeout=None):
**get_request_arguments(settings.STORE_SSL_AUTH, **get_request_arguments(settings.STORE_SSL_AUTH,
settings.STORE_BASIC_AUTH)) settings.STORE_BASIC_AUTH))
return r return r
except Exception: except Exception as e:
logger.error("Error in store GET: %s" % e)
dummy = Mock() dummy = Mock()
setattr(dummy, "status_code", 200) setattr(dummy, "status_code", 200)
setattr(dummy, "content", "[]") setattr(dummy, "content", "[]")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment