Commit 72162a3f authored by janis.streib's avatar janis.streib 🦉
Browse files

UPD: middleware: more graceful 404 handling

parent 71e389ce
...@@ -75,7 +75,7 @@ def oui_lookup(): ...@@ -75,7 +75,7 @@ def oui_lookup():
mac = format_mac(request.args['mac']) mac = format_mac(request.args['mac'])
vendor = OUI_DB.get(mac[:8], None) vendor = OUI_DB.get(mac[:8], None)
if vendor is None: if vendor is None:
return abort(404) return jsonify({'mac': mac, 'vendor': None}), 404
return jsonify({'mac': mac, 'vendor': vendor}) return jsonify({'mac': mac, 'vendor': vendor})
......
...@@ -134,7 +134,7 @@ def handle_db_error(e): ...@@ -134,7 +134,7 @@ def handle_db_error(e):
@app.errorhandler(404) @app.errorhandler(404)
def handle_not_found(e): def handle_not_found(e):
return jsonify({'type': 'not found', 'error': str(e)}), 404 return e
@app.errorhandler(Exception) @app.errorhandler(Exception)
def handle_generic(e): def handle_generic(e):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment