File tree Expand file tree Collapse file tree 1 file changed +21
-4
lines changed
Expand file tree Collapse file tree 1 file changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -290,10 +290,13 @@ private static void AssertResponseSuccess(HttpResponseMessage responseMessage)
290290 var responseCode = ( int ) responseMessage . StatusCode ;
291291 var responseBody = responseMessage . Content . ReadAsStringAsync ( ) . Result ;
292292
293- throw CreateApiExceptionRequestUnsuccessful ( responseCode , responseBody ) ;
293+ throw CreateApiExceptionRequestUnsuccessful (
294+ responseCode ,
295+ responseBody ,
296+ GetResponsId ( responseMessage . Headers )
297+ ) ;
294298 }
295299
296- private static ApiException CreateApiExceptionRequestUnsuccessful ( int responseCode , string responseBody )
297300 private static string GetResponsId ( HttpHeaders allHeader )
298301 {
299302 if ( allHeader . Contains ( HEADER_RESPONSE_ID_UPPER_CASE ) )
@@ -306,14 +309,28 @@ private static string GetResponsId(HttpHeaders allHeader)
306309
307310 throw new BunqException ( ERROR_COULD_NOT_DETERMINE_RESPONSE_ID_HEADER ) ;
308311 }
312+
313+ private static ApiException CreateApiExceptionRequestUnsuccessful (
314+ int responseCode ,
315+ string responseBody ,
316+ string responseId
317+ )
309318 {
310319 try
311320 {
312- return ExceptionFactory . CreateExceptionForResponse ( responseCode , FetchErrorDescriptions ( responseBody ) ) ;
321+ return ExceptionFactory . CreateExceptionForResponse (
322+ responseCode ,
323+ FetchErrorDescriptions ( responseBody ) ,
324+ responseId
325+ ) ;
313326 }
314327 catch ( JsonException )
315328 {
316- return ExceptionFactory . CreateExceptionForResponse ( responseCode , new List < string > { responseBody } ) ;
329+ return ExceptionFactory . CreateExceptionForResponse (
330+ responseCode ,
331+ new List < string > { responseBody } ,
332+ responseId
333+ ) ;
317334 }
318335 }
319336
You can’t perform that action at this time.
0 commit comments