Skip to content

Commit

Permalink
Reclassify model loading error as server errors (#457)
Browse files Browse the repository at this point in the history
* Reclassify model loading error as server errors
* adapt unittests
  • Loading branch information
oOraph authored Oct 1, 2024
1 parent 8b71cc4 commit 45907cd
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 0 additions & 2 deletions api_inference_community/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,6 @@ async def pipeline_route(request: Request) -> Response:
f'{error["msg"]}: received `{error["input"]}` in `parameters`'
)
return JSONResponse({"error": errors}, status_code=400)
except (EnvironmentError, ValueError) as e:
return JSONResponse({"error": str(e)}, status_code=400)
except Exception as e:
return JSONResponse({"error": str(e)}, status_code=500)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ async def startup_event():

self.assertEqual(
response.status_code,
400,
500,
)
self.assertEqual(
response.content,
Expand Down

0 comments on commit 45907cd

Please sign in to comment.