@@ -0,0 +1,1873 @@
+package com.github.sbugat.samplerest.resource;%0A%0Aimport javax.ws.rs.core.Response;%0Aimport javax.ws.rs.core.Response.Status;%0Aimport javax.ws.rs.ext.ExceptionMapper;%0Aimport javax.ws.rs.ext.Provider;%0A%0Aimport com.github.sbugat.samplerest.exception.ApiException;%0Aimport com.github.sbugat.samplerest.exception.BadRequestException;%0Aimport com.github.sbugat.samplerest.exception.NotFoundException;%0Aimport com.github.sbugat.samplerest.model.ApiResponse;%0A%0A@Provider%0Apublic class SampleExceptionMapper implements ExceptionMapper%3CException%3E %7B%0A%0A%09@Override%0A%09public Response toResponse(final Exception exception) %7B%0A%09%09if (exception instanceof javax.ws.rs.WebApplicationException) %7B%0A%09%09%09final javax.ws.rs.WebApplicationException e = (javax.ws.rs.WebApplicationException) exception;%0A%09%09%09return Response.status(e.getResponse().getStatus()).entity(new ApiResponse(e.getResponse().getStatus(), exception.getMessage())).type(%22application/json%22).build();%0A%09%09%7D else if (exception instanceof com.fasterxml.jackson.core.JsonParseException) %7B%0A%09%09%09return Response.status(Status.BAD_REQUEST).entity(new ApiResponse(400, %22bad input%22)).build();%0A%09%09%7D else if (exception instanceof NotFoundException) %7B%0A%09%09%09return Response.status(Status.NOT_FOUND).entity(new ApiResponse(ApiResponse.ERROR, exception.getMessage())).type(%22application/json%22).build();%0A%09%09%7D else if (exception instanceof BadRequestException) %7B%0A%09%09%09return Response.status(Status.BAD_REQUEST).entity(new ApiResponse(ApiResponse.ERROR, exception.getMessage())).type(%22application/json%22).build();%0A%09%09%7D else if (exception instanceof ApiException) %7B%0A%09%09%09return Response.status(Status.BAD_REQUEST).entity(new ApiResponse(ApiResponse.ERROR, exception.getMessage())).type(%22application/json%22).build();%0A%09%09%7D else %7B%0A%09%09%09return Response.status(Status.INTERNAL_SERVER_ERROR).entity(new ApiResponse(500, %22Internal server error%22)).type(%22application/json%22).build();%0A%09%09%7D%0A%09%7D%0A%7D

Add exception mapper