Skip to content

Commit

Permalink
Implement ConnectionError handler (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
felipeall authored Jan 23, 2024
1 parent 0d7bf48 commit c41e6b3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/services/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ def make_request(self, url: Optional[str] = None) -> Response:
)
except TooManyRedirects:
raise HTTPException(status_code=404, detail=f"Not found for url: {url}")
except ConnectionError:
raise HTTPException(status_code=500, detail=f"Connection error for url: {url}")
except Exception as e:
raise HTTPException(status_code=500, detail=f"Error for url: {url}. {e}")
if 400 <= response.status_code < 500:
raise HTTPException(
status_code=response.status_code,
Expand Down

0 comments on commit c41e6b3

Please sign in to comment.