code: private void validate(JSONObject json) throws HelloSignException {
          if (json.has("error")) {
              try {
                  JSONObject error = json.getJSONObject("error");
                  String message = error.getString("error_msg");
                  String type = error.getString("error_name");
                  throw new HelloSignException(message, getLastResponseCode(), type);
              } catch (JSONException ex) {
                  throw new HelloSignException(ex);
              }
          }
      }
docs: Inspects the JSONObject response for errors and throws an exception if
  found.
  
  @param json JSONObject response
  @param code HTTP response code
  @throws HelloSignException thrown if an error is reported from the API
  call