Skip to content

Commit 86a35d0

Browse files
authored
status code: input parsing, no exception (#460)
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
1 parent bca91af commit 86a35d0

File tree

1 file changed

+0
-5
lines changed

1 file changed

+0
-5
lines changed

api_inference_community/routes.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,6 @@ async def pipeline_route(request: Request) -> Response:
129129

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

0 commit comments

Comments
 (0)