15 lines
316 B
Python
15 lines
316 B
Python
from flask import Flask, jsonify
|
|
|
|
|
|
def name_not_found_error(e):
|
|
return jsonify(error=str(e)), 404
|
|
|
|
|
|
def bad_request_error(e):
|
|
return jsonify(error=str(e)), 400
|
|
|
|
|
|
def register_errors(app: Flask):
|
|
app.register_error_handler(404, name_not_found_error)
|
|
app.register_error_handler(400, bad_request_error)
|