Skip to content

Commit 5a43e41

Browse files
committed
Change to use the native Http Reqest Execption
1 parent 445ad43 commit 5a43e41

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

firebaseai/src/Internal/HttpHelpers.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,12 @@ internal static async Task ValidateHttpResponse(HttpResponseMessage response)
106106
}
107107

108108
// Construct the exception with as much information as possible.
109-
var ex = new HttpRequestException(
109+
throw new HttpRequestException(
110110
$"HTTP request failed with status code: {(int)response.StatusCode} ({response.ReasonPhrase}).\n" +
111-
$"Error Content: {errorContent}"
111+
$"Error Content: {errorContent}",
112+
null,
113+
response.StatusCode
112114
);
113-
ex.Data["StatusCode"] = (int)response.StatusCode;
114-
115-
throw ex;
116115
}
117116
}
118117
}

0 commit comments

Comments
 (0)