diff --git a/components/org.wso2.carbon.identity.api.user.recovery/org.wso2.carbon.identity.rest.api.user.recovery.v2/src/main/java/org/wso2/carbon/identity/rest/api/user/recovery/v2/impl/core/Constants.java b/components/org.wso2.carbon.identity.api.user.recovery/org.wso2.carbon.identity.rest.api.user.recovery.v2/src/main/java/org/wso2/carbon/identity/rest/api/user/recovery/v2/impl/core/Constants.java index dde101bf1..576317c37 100644 --- a/components/org.wso2.carbon.identity.api.user.recovery/org.wso2.carbon.identity.rest.api.user.recovery.v2/src/main/java/org/wso2/carbon/identity/rest/api/user/recovery/v2/impl/core/Constants.java +++ b/components/org.wso2.carbon.identity.api.user.recovery/org.wso2.carbon.identity.rest.api.user.recovery.v2/src/main/java/org/wso2/carbon/identity/rest/api/user/recovery/v2/impl/core/Constants.java @@ -38,6 +38,7 @@ public class Constants { public static final String STATUS_PRECONDITION_FAILED_MESSAGE_DEFAULT = "Precondition Failed"; public static final String STATUS_INTERNAL_SERVER_ERROR_DESCRIPTION_DEFAULT = "The server encountered an internal error. Please contact administrator."; + public static final String STATUS_BAD_REQUEST_DEFAULT = "Bad Request"; // Recovery type. public static final String RECOVERY_WITH_NOTIFICATIONS = "recoverWithNotifications"; diff --git a/components/org.wso2.carbon.identity.api.user.recovery/org.wso2.carbon.identity.rest.api.user.recovery.v2/src/main/java/org/wso2/carbon/identity/rest/api/user/recovery/v2/impl/core/utils/RecoveryUtil.java b/components/org.wso2.carbon.identity.api.user.recovery/org.wso2.carbon.identity.rest.api.user.recovery.v2/src/main/java/org/wso2/carbon/identity/rest/api/user/recovery/v2/impl/core/utils/RecoveryUtil.java index e097532d9..9dea04df9 100644 --- a/components/org.wso2.carbon.identity.api.user.recovery/org.wso2.carbon.identity.rest.api.user.recovery.v2/src/main/java/org/wso2/carbon/identity/rest/api/user/recovery/v2/impl/core/utils/RecoveryUtil.java +++ b/components/org.wso2.carbon.identity.api.user.recovery/org.wso2.carbon.identity.rest.api.user.recovery.v2/src/main/java/org/wso2/carbon/identity/rest/api/user/recovery/v2/impl/core/utils/RecoveryUtil.java @@ -256,6 +256,10 @@ public static WebApplicationException handleIdentityRecoveryException(IdentityRe getCode().equals(e.getErrorCode())) { return RecoveryUtil.buildRetryPasswordResetObject(tenantDomain, errorDescription, errorCode, code, correlationId); + } else if (IdentityRecoveryConstants.ErrorMessages.ERROR_CODE_INVALID_CHANNEL_ID.getCode().equals( + e.getErrorCode())) { + errorMessage = Constants.STATUS_BAD_REQUEST_DEFAULT; + status = Response.Status.BAD_REQUEST; } if (e instanceof IdentityRecoveryClientException) {