Skip to content

Commit

Permalink
better logging
Browse files Browse the repository at this point in the history
  • Loading branch information
HauklandJ committed Dec 19, 2024
1 parent 6d1c1e7 commit 2ebb778
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public async Task<DelegationResponse> DelegateRights(DelegationRequest delegatio
logger.LogError(
"Got error status code for access management request. Status code: {StatusCode}. Problem details: {ProblemDetails}",
httpResponseMessage.StatusCode,
problemDetails
JsonSerializer.Serialize(problemDetails)
);
throw new AccessManagementRequestException(
"Got error status code for access management request.",
Expand All @@ -97,13 +97,16 @@ public async Task<DelegationResponse> DelegateRights(DelegationRequest delegatio
}
catch (Exception e)
{
var ex = new AccessManagementRequestException(
$"Something went wrong when processing the access management request.",
null,
httpResponseMessage?.StatusCode,
httpContent,
e
);
var ex =
e is AccessManagementRequestException
? e
: new AccessManagementRequestException(
$"Something went wrong when processing the access management request.",
null,
httpResponseMessage?.StatusCode,
httpContent,
e
);
logger.LogError(ex, "Error when processing access management request.");

// TODO: metrics
Expand Down

0 comments on commit 2ebb778

Please sign in to comment.