Skip to content

Commit

Permalink
status code: input parsing, no exception (#460)
Browse files Browse the repository at this point in the history
example:
task: image-to-image
if the user provides sth that cannot be parsed by PIL (eg an image)
PIL will raise an OSError (and EnvironmentError is an alias for OSError, kept for backward compat)
But actually this "OSError" is due to some bad payload provided by the user.
So let's consider that we have filtered all internal errors when loading pipeline
  • Loading branch information
oOraph authored Oct 7, 2024
1 parent bca91af commit 86a35d0
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions api_inference_community/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,6 @@ async def pipeline_route(request: Request) -> Response:

try:
inputs, params = normalize_payload(payload, task, sampling_rate=sampling_rate)
except EnvironmentError as e:
# Since we catch the environment edge cases earlier above, this should not happen here anymore
# harmless to keep it, just in case
logger.error("Error while parsing input %s", e)
return JSONResponse({"error": str(e)}, status_code=500)
except ValidationError as e:
errors = []
for error in e.errors():
Expand Down

0 comments on commit 86a35d0

Please sign in to comment.