Skip to content

Commit 8e6263e

Browse files
committed
Allow 404 exceptions to propagate
Don't try to read the response body.
1 parent f8ccb4a commit 8e6263e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/PostHog/Library/HttpClientExtensions.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,17 @@ public static async Task EnsureSuccessfulApiCall(
4545
this HttpResponseMessage response,
4646
CancellationToken cancellationToken)
4747
{
48-
// TODO: Is there any error status codes that we should allow the exception to propagate here?
4948
if (response.IsSuccessStatusCode)
5049
{
5150
return;
5251
}
52+
53+
if (response.StatusCode == HttpStatusCode.NotFound)
54+
{
55+
// Allow 404 exception to propagate up.
56+
response.EnsureSuccessStatusCode();
57+
}
58+
5359
var (error, exception) = await ReadApiErrorResultAsync();
5460

5561
throw response.StatusCode switch

0 commit comments

Comments
 (0)