Skip to content

Commit

Permalink
Add 404 handler.
Browse files Browse the repository at this point in the history
  • Loading branch information
ktlim committed Apr 30, 2024
1 parent 7461a7c commit a388c27
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions python/lsst/consdb/pqserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import sqlalchemy.exc
import werkzeug.exceptions
from flask import Flask, jsonify, request
from sqlalchemy import MetaData

Expand Down Expand Up @@ -117,6 +118,11 @@ def handle_bad_value(e: BadValueException):
return jsonify(e.to_dict()), e.status_code


@app.errorhandler(werkzeug.exceptions.NotFound)
def handle_not_found(e):
logger.error(e)
return f"not found: {e}", 404

###################################
# Web service application methods #
###################################
Expand Down

0 comments on commit a388c27

Please sign in to comment.