Skip to content

Commit

Permalink
Merge pull request #762 from Thisara-Welmilla/fix-issue-not-logging-e…
Browse files Browse the repository at this point in the history
…rrors

Fix not logging errors from API server.
  • Loading branch information
Thisara-Welmilla authored Dec 18, 2024
2 parents aabb4d8 + 4e96ccc commit d9ce3b6
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1010,13 +1010,15 @@ private APIError handleIdPException(IdentityProviderManagementException e,
*/
private APIError handleAuthenticatorException(AuthenticatorMgtException e) {

ErrorResponse errorResponse = new ErrorResponse.Builder()
ErrorResponse.Builder errorResponseBuilder = new ErrorResponse.Builder()
.withCode(e.getErrorCode())
.withMessage(e.getMessage())
.withDescription(e.getDescription()).build();
.withDescription(e.getDescription());
Response.Status status;
ErrorResponse errorResponse;

if (e instanceof AuthenticatorMgtClientException) {
errorResponse = errorResponseBuilder.build(log, e.getMessage());
if (e.getErrorCode() != null) {
String errorCode = e.getErrorCode();
errorCode =
Expand All @@ -1027,6 +1029,7 @@ private APIError handleAuthenticatorException(AuthenticatorMgtException e) {
errorResponse.setDescription(e.getDescription());
status = Response.Status.BAD_REQUEST;
} else if (e instanceof AuthenticatorMgtServerException) {
errorResponse = errorResponseBuilder.build(log, e, e.getMessage());
if (e.getErrorCode() != null) {
String errorCode = e.getErrorCode();
errorCode =
Expand All @@ -1037,6 +1040,7 @@ private APIError handleAuthenticatorException(AuthenticatorMgtException e) {
errorResponse.setDescription(e.getDescription());
status = Response.Status.INTERNAL_SERVER_ERROR;
} else {
errorResponse = errorResponseBuilder.build(log, e, e.getMessage());
status = Response.Status.INTERNAL_SERVER_ERROR;
}
return new APIError(status, errorResponse);
Expand Down

0 comments on commit d9ce3b6

Please sign in to comment.