Fix internal ValueError exception should return 422 (not 404 as before)

This commit is contained in:
allegroai 2024-01-06 17:55:49 +02:00
parent 02fef01657
commit 368a03dc70

View File

@ -89,7 +89,7 @@ async def serve_model(model_id: str, version: Optional[str] = None, request: Uni
request_body=request
)
except ValueError as ex:
raise HTTPException(status_code=404, detail="Error processing request: {}".format(ex))
raise HTTPException(status_code=422, detail="Error processing request: {}".format(ex))
except Exception as ex:
raise HTTPException(status_code=500, detail="Error processing request: {}".format(ex))
return return_value