From 2b14eb08a061bb9bb22ddeb3c546d4af1392bc01 Mon Sep 17 00:00:00 2001 From: Nattapon Wongpaet Date: Thu, 23 Aug 2018 14:16:26 +0700 Subject: [PATCH] fix bug --- ais-structure/src/modules/helper/connection.js | 44 +++++++------------------------------------- 1 file changed, 7 insertions(+), 37 deletions(-) diff --git a/ais-structure/src/modules/helper/connection.js b/ais-structure/src/modules/helper/connection.js index ca13077..06d4dd1 100644 --- a/ais-structure/src/modules/helper/connection.js +++ b/ais-structure/src/modules/helper/connection.js @@ -165,12 +165,14 @@ connection.requestJsonToD01 = async function (obj,cmd,myMethod) { var resultRes = await asyncRequest(params,objectData,funStats); - // console.log(result); + console.log(resultRes); if(resultRes.response) { var data = JSON.parse(resultRes.response.body); result.response = data; + } else { + result = resultRes; } } @@ -186,50 +188,18 @@ connection.requestJsonToD01 = async function (obj,cmd,myMethod) { } - // console.log(result); + console.log(result); if(result.response) { - if(!result.response.resultCode) + if(!result.response.resultCode){ result.err = "Missing resultCode"; - - if(!result.response.resultDescription) + } else if(!result.response.resultDescription){ result.err = "Missing resultDescription"; + } } - - // if(result.err) - // { - // result.response = {}; - // result.response.resultCode = "50000"; - - // if(result.err.code == 'ETIMEDOUT'){ - // result.response.resultCode = "50003"; - // result.response.resultDescription = "Timeout"; - // } else if(result.err.code == 'ECONNREFUSED'){ - // result.response.resultCode = "50002"; - // result.response.resultDescription = "Reject"; - // } else { - // if(result.err.indexOf("Missing") != -1){ - // result.response.resultCode = "40300"; - // result.response.resultDescription = result.err; - // } else { - // result.response.resultCode = "50000"; - // result.response.resultDescription = "System error"; - // } - // } - - // if(result.response.resultCode == "40300"){ - // stats.receiveBadRestResponse(service.Name,params.method,cmd); - // } else { - // stats.receiveResponse(service.Name,cmd,"Error"); - // } - - // } - return checkResponse(result,service,params,cmd); - - }; -- libgit2 0.21.2