Skip to content

Commit 84b9c82

Browse files
committed
modify:not handle error info for info report
1 parent d557cc1 commit 84b9c82

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

XEngine_Source/StorageModule_InfoReport/InfoReport_APIMachine/InfoReport_APIMachine.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ bool CInfoReport_APIMachine::InfoReport_APIMachine_Send(LPCXSTR lpszAPIUrl)
6565
SystemApi_HardWare_GetSerial(&st_SDKSerial);
6666

6767
Json::Value st_JsonRoot;
68+
JSONCPP_STRING st_JsonError;
6869
Json::StreamWriterBuilder st_JsonBuilder;
70+
Json::CharReaderBuilder st_JsonReader;
6971

7072
XCHAR tszMachineText[1024] = {};
7173
InfoReport_APIMachine_GetText(tszMachineText);
@@ -85,8 +87,24 @@ bool CInfoReport_APIMachine::InfoReport_APIMachine_Send(LPCXSTR lpszAPIUrl)
8587
InfoReport_dwErrorCode = APIClient_GetLastError();
8688
return false;
8789
}
90+
st_JsonRoot.clear();
91+
//开始解析配置文件
92+
std::unique_ptr<Json::CharReader> const pSt_JsonReader(st_JsonReader.newCharReader());
93+
if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nLen, &st_JsonRoot, &st_JsonError))
94+
{
95+
InfoReport_IsErrorOccur = true;
96+
InfoReport_dwErrorCode = ERROR_XENGINE_STORAGE_INFOREPORT_PARSE;
97+
return false;
98+
}
8899
BaseLib_OperatorMemory_FreeCStyle((XPPMEM)&ptszMsgBuffer);
89100

101+
if (0 != st_JsonRoot["code"].asInt())
102+
{
103+
InfoReport_IsErrorOccur = true;
104+
InfoReport_dwErrorCode = ERROR_XENGINE_STORAGE_INFOREPORT_CODE;
105+
return false;
106+
}
107+
90108
return true;
91109
}
92110
/********************************************************************

0 commit comments

Comments
 (0)