diff --git a/swh/objstorage/api/server.py b/swh/objstorage/api/server.py index 720ecee4693c494e3e60ab60ab6b65f9430186d4..a35959504a69719e8c43a406c44260ba322e3068 100644 --- a/swh/objstorage/api/server.py +++ b/swh/objstorage/api/server.py @@ -86,8 +86,13 @@ app = ObjStorageServerApp( objstorage = None -@app.errorhandler(Error) +@app.errorhandler(ObjNotFoundError) def argument_error_handler(exception): + return error_handler(exception, encode_data, status_code=404) + + +@app.errorhandler(Error) +def objnotfound_error_handler(exception): return error_handler(exception, encode_data, status_code=400)