summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
14fc8de)
With internal error to indicate to client.
Signed-off-by: dliu5 <david.liu@windriver.com>
Change-Id: I234ec021930c0e73f2725562d8273a7b581faa1a
return res(environ, start_response)
return res(environ, start_response)
+def _internal_err_response_wrapper(environ, start_response):
+ res = Response(mimetype='text/plain', status=500)
+ return res(environ, start_response)
+
+
class authmiddleware():
'''
class authmiddleware():
'''
if ret is True:
logger.info(
"auth success with oauth token: " + auth_token)
if ret is True:
logger.info(
"auth success with oauth token: " + auth_token)
- return self.app(environ, start_response)
+ try:
+ return self.app(environ, start_response)
+ except Exception as ex:
+ logger.error(
+ 'Internal exception happend \
+ ed {}'.format(str(ex)), exc_info=True)
+ return \
+ _internal_err_response_wrapper(environ,
+ start_response)
else:
raise AuthFailureExp(
'Bearer realm="Authentication Failed"')
else:
raise AuthFailureExp(
'Bearer realm="Authentication Failed"')
return _response_wrapper(environ, start_response, ex.dictize())
except AuthFailureExp as ex:
return _response_wrapper(environ, start_response, ex.dictize())
return _response_wrapper(environ, start_response, ex.dictize())
except AuthFailureExp as ex:
return _response_wrapper(environ, start_response, ex.dictize())
- except Exception:
- hint = 'Bearer realm="Authentication Required"'
- return _response_wrapper(environ, start_response,
- AuthRequiredExp(hint).dictize())
+ except Exception as ex:
+ logger.error('Internal exception happended {}'.format(
+ str(ex)), exc_info=True)
+ return _internal_err_response_wrapper(environ, start_response)