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

io.nflow.jetty.mapper.WebApplicationExceptionMapper Maven / Gradle / Ivy

There is a newer version: 10.0.0
Show newest version
package io.nflow.jetty.mapper;

import static javax.ws.rs.core.Response.status;

import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;

import io.nflow.rest.v1.msg.ErrorResponse;

@Provider
public class WebApplicationExceptionMapper implements ExceptionMapper {
  @Override
  public Response toResponse(WebApplicationException e) {
    return status(e.getResponse().getStatus()).entity(new ErrorResponse(e.getMessage())).build();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy