From 59281ecda8df5bf44c06e9edbc70e9cbfe061052 Mon Sep 17 00:00:00 2001 From: Josh Gachnang Date: Wed, 10 Jun 2015 10:46:39 -0700 Subject: 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 --- ironic_python_agent/api/controllers/v1/base.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'ironic_python_agent/api/controllers') 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 -- cgit v1.2.1