public BaseResponse(string body) { JSONObject ob; try { ob = (JSONObject)JSONObject.Parse(body); } catch (Exception x) { throw new APIReplyParseException("JSON Parse exception: " + body + "\n" + x.Message); } if (ob == null) { throw new APIReplyParseException("JSON Parse exception: " + body); } else { this.status = (bool?) ob["status"]; this.errCode = new ERR_CODE((string)ob["errorCode"]); this.errorDescr = (string) ob["errorDescr"]; this.returnData = (JSONAware) ob["returnData"]; if (this.status == null) { Console.Error.WriteLine(body); throw new APIReplyParseException("JSON Parse error: " + "\"status\" is null!"); } if ((this.status==null) || ((bool)!this.status)) { Console.Error.WriteLine(body); throw new APIErrorResponse(errCode, errorDescr, body); } } }
/// <summary> /// Constructs an instance of /// <code>APIErrorResponse</code> with the specified detail message. /// </summary> /// <param name="msg"> the detail message. </param> public APIErrorResponse(ERR_CODE code, string errDesc, string msg) : base(msg) { this.code = code; this.errDesc = errDesc; this.msg = msg; }