There are a variety of different formats for error messages:
JSON decode error:
resp = {
'error': 'Unable to parse JSON',
'source_json': err.doc,
'pos': err.pos,
'lineno': err.lineno,
'colno': err.colno
}
403 / Unauth error:
resp = {
'error': {
'status': 403,
'message': 'Unauthorized',
'auth_url': err.auth_url,
'auth_response': err.response,
},
}
404 / Not found:
resp = {
'error': {
'message': 'Not found',
'status': 404,
}
}
Generic 500:
resp = {'error': {'status': 500, 'message': 'Unexpected server error'}}
# TODO only set below two fields in dev mode
resp['error']['class'] = err.__class__.__name__
resp['error']['details'] = str(err)
Decide on a standard format for error messages and implement it uniformly across the different error types.
There are a variety of different formats for error messages:
JSON decode error:
403 / Unauth error:
404 / Not found:
Generic 500:
Decide on a standard format for error messages and implement it uniformly across the different error types.