code: private static JSONObject genError(Integer code, String message) throws JSONException {
          // TODO: HTTP-Status (404, etc), for now return status line
          return new JSONObject("{error: {code: \"" + code.toString() + "\", message: \"" + message + "\"}}");
      }
docs: Generate error as JSONObject
  
  @param   code Error code
  @param   message Error message
  @throws  JSONException
  @return  {@link JSONObject}