Skip to content

Commit

Permalink
fix:e expect GHE to be thrown sometimes
Browse files Browse the repository at this point in the history
Expect a `GeneralHttpException` (GHE) may be thrown by the TMDb library we use if it receives an upstream HTTP Status Code message it doesn't know how to handle.
  • Loading branch information
revam committed Jan 20, 2025
1 parent 31b16f4 commit 85084cb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Shoko.Server/Providers/TMDB/TmdbMetadataService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ TMDB_Show_NetworkRepository xrefTmdbShowNetwork
_retryPolicy = Policy
.Handle<RateLimitRejectedException>()
.Or<HttpRequestException>()
.Or<GeneralHttpException>()
.Or<RequestLimitExceededException>()
.WaitAndRetryAsync(int.MaxValue, (_, _) => TimeSpan.Zero, async (ex, ts, retryCount, ctx) =>
{
Expand Down Expand Up @@ -337,6 +338,11 @@ TMDB_Show_NetworkRepository xrefTmdbShowNetwork
ctx["timeoutRetryCount"] = timeoutRetryCount + 1;
break;
}
case GeneralHttpException ghEx:
{
_logger.LogWarning(ghEx, "Got a general HTTP exception while processing TMDb request: {StatusCode}", (int)ghEx.HttpStatusCode);
goto default;
}
default:
throw ex;
}
Expand Down

0 comments on commit 85084cb

Please sign in to comment.