Skip to content

Commit

Permalink
Fix not logging errors from API server.
Browse files Browse the repository at this point in the history
  • Loading branch information
Thisara-Welmilla committed Dec 18, 2024
1 parent aabb4d8 commit 4e96ccc
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 4e96ccc

Please sign in to comment.