code: public static void throwInternalError(String message, UriInfo uriInfo) {
      GenericError error =  new GenericError(
          message,
          ErrorCode.INTERNAL.getCode(),
          uriInfo.getAbsolutePath().toString());
  
      throw new WebApplicationException(Response.status(Response.Status.INTERNAL_SERVER_ERROR)
          .type(MediaType.APPLICATION_JSON_TYPE)
          .entity(error)
          .build());
    }
docs: Wraps the error as {@link WebApplicationException} with error mapped as JSON Response
  @param message {@link String} representing internal error
  @param uriInfo {@link UriInfo} used for forming link