Skip to content

Commit ae48e40

Browse files
committed
added a errorhandler decorator for 404's
1 parent 09be153 commit ae48e40

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

app.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,9 @@ def filter_by_location(loc):
122122
r = f_loc.to_json()
123123
# Then convert the JSON string to a dict to properly format it when sending the response to the client
124124
return json.loads(r)
125+
126+
127+
# Catch all HTTP 404's and return the below JSON message
128+
@app.errorhandler(404)
129+
def route_not_found(e):
130+
return jsonify({ "error": "The specified route does not exist" })

0 commit comments

Comments
 (0)