All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.katharsis.errorhandling.mapper.KatharsisExceptionMapper Maven / Gradle / Ivy

There is a newer version: 2.6.3
Show newest version
package io.katharsis.errorhandling.mapper;

import io.katharsis.errorhandling.ErrorResponse;
import io.katharsis.errorhandling.exception.KatharsisMappableException;

/**
 * Exception mapper for a generic exception which can be thrown in request processing.
 */
public final class KatharsisExceptionMapper implements JsonApiExceptionMapper {

    @Override
    public ErrorResponse toErrorResponse(KatharsisMappableException exception) {
        return ErrorResponse.builder()
                .setStatus(exception.getHttpStatus())
                .setSingleErrorData(exception.getErrorData())
                .build();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy