@@ -96,7 +96,7 @@ namespace AppInstaller::Http
96
96
const web::json::value& body,
97
97
const HttpClientHelper::HttpRequestHeaders& headers,
98
98
const HttpClientHelper::HttpRequestHeaders& authHeaders,
99
- const HttpResponseHandler& customHandler) const
99
+ const HttpResponseHandler& customHandler) const try
100
100
{
101
101
web::http::http_response httpResponse;
102
102
Post (uri, body, headers, authHeaders).then ([&httpResponse](const web::http::http_response& response)
@@ -115,6 +115,10 @@ namespace AppInstaller::Http
115
115
116
116
return ValidateAndExtractResponse (httpResponse);
117
117
}
118
+ catch (web::http::http_exception& exception )
119
+ {
120
+ RethrowAsWilException (exception );
121
+ }
118
122
119
123
pplx::task<web::http::http_response> HttpClientHelper::Get (
120
124
const utility::string_t & uri,
@@ -148,7 +152,7 @@ namespace AppInstaller::Http
148
152
const utility::string_t & uri,
149
153
const HttpClientHelper::HttpRequestHeaders& headers,
150
154
const HttpClientHelper::HttpRequestHeaders& authHeaders,
151
- const HttpResponseHandler& customHandler) const
155
+ const HttpResponseHandler& customHandler) const try
152
156
{
153
157
web::http::http_response httpResponse;
154
158
Get (uri, headers, authHeaders).then ([&httpResponse](const web::http::http_response& response)
@@ -167,6 +171,10 @@ namespace AppInstaller::Http
167
171
168
172
return ValidateAndExtractResponse (httpResponse);
169
173
}
174
+ catch (web::http::http_exception& exception )
175
+ {
176
+ RethrowAsWilException (exception );
177
+ }
170
178
171
179
void HttpClientHelper::SetPinningConfiguration (const Certificates::PinningConfiguration& configuration)
172
180
{
@@ -233,4 +241,9 @@ namespace AppInstaller::Http
233
241
234
242
return response.extract_json ().get ();
235
243
}
244
+
245
+ [[noreturn]] void HttpClientHelper::RethrowAsWilException (const web::http::http_exception& exception )
246
+ {
247
+ THROW_WIN32_MSG (exception .error_code ().value (), " %hs" , exception .what ());
248
+ }
236
249
}
0 commit comments