class RuntimeExceptionMapper implements ExceptionMapper<RuntimeException> {

    @Override
    public Response toResponse(RuntimeException exception) {

        if (exception instanceof NotFoundException) {
            return Response.status(Status.NOT_FOUND).build();
        } else {
            logger.error("Error occured", exception);
            return Response.status(Status.INTERNAL_SERVER_ERROR)
                    .entity(new ExceptionResponse("Unexpected Internal Exception")).build();
        }
    }

}