Skip to content

Commit

Permalink
Improve difficalcy error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Syriiin committed Jun 8, 2024
1 parent 5b0b450 commit cb7d31e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions common/osu/difficultycalculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,13 @@ def calculate_score(self, score: Score) -> Calculation:
)
response.raise_for_status()
data = response.json()
except httpx.HTTPStatusError as e:
raise CalculationException(
f"An error occured in calculating the beatmap {score.beatmap_id}: {e.request.url} [{e.response.status_code}] {e.response.text}"
) from e
except httpx.HTTPError as e:
raise CalculationException(
f"An error occured in calculating the beatmap {score.beatmap_id}: [{e.response.status_code}] {e.response.text}"
f"An error occured in calculating the beatmap {score.beatmap_id}: {e.request.url} - {e}"
) from e

return Calculation(
Expand All @@ -350,10 +354,14 @@ def calculate_score_batch(self, scores: Iterable[Score]) -> list[Calculation]:
)
response.raise_for_status()
data = response.json()
except httpx.HTTPError as e:
except httpx.HTTPStatusError as e:
raise CalculationException(
f"An error occured in calculating the beatmaps {set(score.beatmap_id for score in scores)}: [{e.response.status_code}] {e.response.text}"
) from e
except httpx.HTTPError as e:
raise CalculationException(
f"An error occured in calculating the beatmaps {set(score.beatmap_id for score in scores)}: {e}"
) from e

return [
Calculation(
Expand Down

0 comments on commit cb7d31e

Please sign in to comment.