code: public String toUserPresentableMessage(IOException ioe, @Nullable String action) {
      String message = "Internal server error";
      if (isClientError(ioe)) {
        message = getErrorMessage(ioe);
      }
  
      if (action == null) {
        return message;
      } else {
        return String.format("Encountered an error while %s: %s", action, message);
      }
    }
docs: Converts the exception to a user-presentable error message. Specifically,
  extracts message field for HTTP 4xx codes, and creates a generic
  "Internal Server Error" for HTTP 5xx codes.