summaryrefslogtreecommitdiff
path: root/ironic_python_agent/api/controllers
diff options
context:
space:
mode:
authorJosh Gachnang <josh@pcsforeducation.com>2015-06-10 10:46:39 -0700
committerJosh Gachnang <josh@pcsforeducation.com>2015-07-28 09:37:43 -0700
commit59281ecda8df5bf44c06e9edbc70e9cbfe061052 (patch)
tree75083d526e057f37a61ba71a94c20a65c17c5ef5 /ironic_python_agent/api/controllers
parentc641371acee120aaa62342ce255161ed43c3b9df (diff)
downloadironic-python-agent-59281ecda8df5bf44c06e9edbc70e9cbfe061052.tar.gz
Improve IPA logging and exception handling
Debugging the agent is a huge pain point. Tracebacks are rarely logged, error messages are often only returned via the API, and lack of info logging makes it hard to determine where some failures occur. Some errors only return a 500 with no error message or logs. Change-Id: I0a127de6e4abf62e20d5c5ad583ba46738604d2d
Diffstat (limited to 'ironic_python_agent/api/controllers')
-rw-r--r--ironic_python_agent/api/controllers/v1/base.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/ironic_python_agent/api/controllers/v1/base.py b/ironic_python_agent/api/controllers/v1/base.py
index 769f819b..1e834ad8 100644
--- a/ironic_python_agent/api/controllers/v1/base.py
+++ b/ironic_python_agent/api/controllers/v1/base.py
@@ -26,12 +26,12 @@ class ExceptionType(wtypes.UserType):
return value
def tobasetype(self, value):
- """Turn a RESTError into a dict."""
+ """Turn an Exception into a dict."""
return {
'type': value.__class__.__name__,
- 'code': value.status_code,
- 'message': value.message,
- 'details': value.details,
+ 'code': getattr(value, 'status_code', 500),
+ 'message': str(value),
+ 'details': getattr(value, 'details', ''),
}
frombasetype = tobasetype