Search in sources :

Example 1 with ErrorType

use of org.apache.syncope.ext.scimv2.api.type.ErrorType in project syncope by apache.

the class SCIMExceptionMapper method builder.

private ResponseBuilder builder(final ClientExceptionType hType, final String msg) {
    ResponseBuilder builder = Response.status(hType.getResponseStatus());
    ErrorType scimType = null;
    if (hType.name().startsWith("Invalid") || hType == ClientExceptionType.RESTValidation) {
        scimType = ErrorType.invalidValue;
    } else if (hType == ClientExceptionType.EntityExists) {
        scimType = ErrorType.uniqueness;
    }
    return builder.entity(new SCIMError(scimType, hType.getResponseStatus().getStatusCode(), msg));
}
Also used : ErrorType(org.apache.syncope.ext.scimv2.api.type.ErrorType) SCIMError(org.apache.syncope.ext.scimv2.api.data.SCIMError) ResponseBuilder(javax.ws.rs.core.Response.ResponseBuilder)

Aggregations

ResponseBuilder (javax.ws.rs.core.Response.ResponseBuilder)1 SCIMError (org.apache.syncope.ext.scimv2.api.data.SCIMError)1 ErrorType (org.apache.syncope.ext.scimv2.api.type.ErrorType)1