java-helidon.server.libraries.mp.api_exception_mapper.mustache Maven / Gradle / Ivy
{{>licenseInfo}}
package {{apiPackage}};
import {{rootJavaEEPackage}}.ws.rs.core.MultivaluedMap;
import {{rootJavaEEPackage}}.ws.rs.core.Response;
import {{rootJavaEEPackage}}.ws.rs.ext.Provider;
import org.eclipse.microprofile.rest.client.ext.ResponseExceptionMapper;
@Provider
public class ApiExceptionMapper implements ResponseExceptionMapper {
@Override
public boolean handles(int status, MultivaluedMap headers) {
return status >= 400;
}
@Override
public ApiException toThrowable(Response response) {
return new ApiException(response);
}
}