code: private static JSONObject genError(HttpResponse response) throws JSONException {
      	String code		= response.getFirstHeader("X-Upwork-Error-Code").getValue();
      	String message	= response.getFirstHeader("X-Upwork-Error-Message").getValue();
      	
      	if (code == null) {
      		code = Integer.toString(response.getStatusLine().getStatusCode());
      	}
      	
      	if (message == null) {
      		message = response.getStatusLine().toString();
      	}
  
      	return new JSONObject("{error: {code: \"" + code + "\", message: \"" + message + "\"}}");
      }
docs: Generate error as JSONObject
  
  @param   code Error code
  @param   message Error message
  @throws  JSONException
  @return  {@link JSONObject}