// Path: services/facade/src/main/java/eu/hlavki/identity/services/rest/model/AppError.java
// @Getter
// @Setter
// @NoArgsConstructor
// @AllArgsConstructor
// @XmlRootElement
// public class AppError {
// 
//     String code;
//     String message;
// 
// 
//     public final static ResponseBuilder toResponse(String code, Throwable t) {
//         return Response.ok(new AppError(code, t.getMessage())).status(Response.Status.INTERNAL_SERVER_ERROR);
//     }
// 
// 
//     public final static ResponseBuilder toResponse(String code, String message) {
//         return Response.ok(new AppError(code, message)).status(Response.Status.INTERNAL_SERVER_ERROR);
//     }
// 
// 
//     public final static ResponseBuilder toResponse(String code, String message, Response.Status status) {
//         return Response.ok(new AppError(code, message)).status(status);
//     }
// }


import eu.hlavki.identity.services.rest.model.AppError;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.Provider;
package eu.hlavki.identity.services.rest.exception;


@Provider
public class ValidationExceptionMapper extends org.apache.cxf.jaxrs.validation.ValidationExceptionMapper {

    public ValidationExceptionMapper() {
    }


    @Override
    protected Response buildResponse(Response.Status errorStatus, String responseText) {
// Path: services/facade/src/main/java/eu/hlavki/identity/services/rest/model/AppError.java
// @Getter
// @Setter
// @NoArgsConstructor
// @AllArgsConstructor
// @XmlRootElement
// public class AppError {
// 
//     String code;
//     String message;
// 
// 
//     public final static ResponseBuilder toResponse(String code, Throwable t) {
//         return Response.ok(new AppError(code, t.getMessage())).status(Response.Status.INTERNAL_SERVER_ERROR);
//     }
// 
// 
//     public final static ResponseBuilder toResponse(String code, String message) {
//         return Response.ok(new AppError(code, message)).status(Response.Status.INTERNAL_SERVER_ERROR);
//     }
// 
// 
//     public final static ResponseBuilder toResponse(String code, String message, Response.Status status) {
//         return Response.ok(new AppError(code, message)).status(status);
//     }
// }


// Path: services/facade/src/main/java/eu/hlavki/identity/services/rest/exception/ValidationExceptionMapper.java
import eu.hlavki.identity.services.rest.model.AppError;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.Provider;

package eu.hlavki.identity.services.rest.exception;


@Provider
public class ValidationExceptionMapper extends org.apache.cxf.jaxrs.validation.ValidationExceptionMapper {

    public ValidationExceptionMapper() {
    }


    @Override
    protected Response buildResponse(Response.Status errorStatus, String responseText) {
        return AppError.toResponse("VALIDATION_ERR", responseText, errorStatus).build();