code: public static Response internalError(Throwable throwable, UriInfo uriInfo) {
      GenericError error =  new GenericError(
          ExceptionUtils.getRootCauseMessage(throwable),
          ErrorCode.INTERNAL.getCode(),
          uriInfo.getAbsolutePath().toString());
  
      if (!isProduction()) {
        error.setStack(ExceptionUtils.getStackTrace(throwable));
      }
  
      return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
          .type(MediaType.APPLICATION_JSON_TYPE)
          .entity(error)
          .build();
    }
docs: Creates Jersey response corresponding to internal error
  @param throwable {@link Throwable} object representing an error
  @param uriInfo {@link UriInfo} object used for forming links
  @return {@link Response} Jersey response object containing JSON representation of the error.