mirror of
https://github.com/devplayer0/docker-net-dhcp
synced 2024-11-18 21:28:05 +00:00
Add 404 and server error handlers
This commit is contained in:
parent
a616342e2e
commit
10005d74d3
@ -1,5 +1,13 @@
|
||||
from flask import Flask
|
||||
from flask import Flask, jsonify
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
from . import network, ipam
|
||||
from . import network, ipam
|
||||
|
||||
@app.errorhandler(404)
|
||||
def err_not_found(e):
|
||||
return jsonify({'Err': 'API not found'}), 404
|
||||
|
||||
@app.errorhandler(Exception)
|
||||
def err(e):
|
||||
return jsonify({'Err': f'Error: {e}'}), 500
|
||||
|
Loading…
Reference in New Issue
Block a user