Java.libraries.microprofile.api_exception_mapper.mustache Maven / Gradle / Ivy
{{>licenseInfo}}
package {{apiPackage}};
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
import javax.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);
}
}