"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "zaqar/common/api/utils.py" between
zaqar-9.0.0.tar.gz and zaqar-10.0.0.tar.gz

About: OpenStack Zaqar is a multi-tenant cloud messaging and notification service for web and mobile developers.
The "Ussuri" series (latest release).

utils.py  (zaqar-9.0.0):utils.py  (zaqar-10.0.0)
skipping to change at line 191 skipping to change at line 191
This decorator catches generic Exceptions and returns a generic This decorator catches generic Exceptions and returns a generic
Response. Response.
""" """
@functools.wraps(func) @functools.wraps(func)
def wrapper(*args, **kwargs): def wrapper(*args, **kwargs):
try: try:
return func(*args, **kwargs) return func(*args, **kwargs)
except Exception as ex: except Exception as ex:
LOG.exception(ex)
error = _("Unexpected error.") error = _("Unexpected error.")
headers = {'status': 500} headers = {'status': 500}
# args[0] - Endpoints object, args[1] - Request object. # args[0] - Endpoints object, args[1] - Request object.
req = args[1] req = args[1]
LOG.exception(error)
return error_response(req, ex, headers, error) return error_response(req, ex, headers, error)
return wrapper return wrapper
def error_response(req, exception, headers=None, error=None): def error_response(req, exception, headers=None, error=None):
body = {'exception': str(exception), 'error': error} body = {'exception': str(exception), 'error': error}
resp = response.Response(req, body, headers) resp = response.Response(req, body, headers)
return resp return resp
def format_message(message, claim_id=None): def format_message(message, claim_id=None):
 End of changes. 2 change blocks. 
1 lines changed or deleted 1 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)