public static UFXErrorResponse Handle(DataParser dataParser) { //Set the default error code as -1, meaning failure UFXErrorResponse errorResponse = new UFXErrorResponse { ErrorCode = -1 }; if (dataParser.DataSets.Count == 0) { return(errorResponse); } var dataSet = dataParser.DataSets[0]; if (dataSet.Rows.Count == 0) { return(errorResponse); } var row = dataSet.Rows[0]; if (row.Columns.ContainsKey("ErrorCode")) { errorResponse.ErrorCode = row.Columns["ErrorCode"].GetInt(); } if (row.Columns.ContainsKey("ErrorMsg")) { errorResponse.ErrorMessage = row.Columns["ErrorMsg"].GetStr(); } if (row.Columns.ContainsKey("MsgDetail")) { errorResponse.MessageDetail = row.Columns["MsgDetail"].GetStr(); } if (row.Columns.ContainsKey("DataCount")) { errorResponse.DataCount = row.Columns["DataCount"].GetInt(); } //subscriber if (row.Columns.ContainsKey("msgtype")) { errorResponse.ErrorCode = 0; } return(errorResponse); }
public static void Error(ILog logger, UFXFunctionCode functionCode, UFXErrorResponse err) { string msg = string.Format("功能号: [{0}], 错误码: {1}, 消息: {2}", (int)functionCode, err.ErrorCode, err.ErrorMessage); logger.Error(msg); }