Skip to content
This repository has been archived by the owner on Mar 24, 2021. It is now read-only.

Commit

Permalink
Make exception_handler handle all exception types
Browse files Browse the repository at this point in the history
Previously exception_handler expected exceptions to have name and code attributes. We now default to 'Internal error' and 500 respectively if these attributes do not exist.
  • Loading branch information
nick-gravgaard committed Jan 14, 2014
1 parent 4ba43e8 commit 13f318c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion backdrop/read/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ def default(self, obj):
@app.errorhandler(404)
def exception_handler(e):
app.logger.exception(e)
return jsonify(status='error', message=e.name), e.code
return jsonify(status='error',
message=getattr(e, 'name', 'Internal error')), getattr(e, 'code', 500)


@app.route('/_status', methods=['GET'])
Expand Down

0 comments on commit 13f318c

Please sign in to comment.