Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverrahner committed Oct 14, 2024
2 parents 8fa186c + c374ce2 commit f3c3b63
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,12 @@ public OnboardResponse Onboard(OnboardParameters onboardParameters)

if (!httpResponseMessage.IsSuccessStatusCode) {
var onboardErrorResponse = JsonConvert.DeserializeObject<OnboardErrorResponse>(result);
throw new OnboardException(httpResponseMessage.StatusCode, onboardErrorResponse.OnboardError);
throw new OnboardException(httpResponseMessage.StatusCode, onboardErrorResponse?.OnboardError ?? new OnboardError()
{
Code = "Unstructured",
Message = result
}
);
}

var onboardingResponse = JsonConvert.DeserializeObject(result, typeof(OnboardResponse));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ public void Revoke(RevokeParameters revokeParameters, string privateKey)
var httpResponseMessage = _httpClient.SendAsync(httpRequestMessage).Result;

if (!httpResponseMessage.IsSuccessStatusCode) {
var onboardErrorResponse = JsonConvert.DeserializeObject<OnboardErrorResponse>(httpResponseMessage.Content.ReadAsStringAsync().Result);
var result = httpResponseMessage.Content.ReadAsStringAsync().Result;
var onboardErrorResponse = JsonConvert.DeserializeObject<OnboardErrorResponse>(result);
throw new RevokeException(httpResponseMessage.StatusCode, onboardErrorResponse.OnboardError);
}
}
Expand Down

0 comments on commit f3c3b63

Please sign in to comment.