Commit 2b14eb08a061bb9bb22ddeb3c546d4af1392bc01

Authored by Nattapon Wongpaet
1 parent 23fec3d4
Exists in master and in 1 other branch dev

fix bug

Showing 1 changed file with 7 additions and 37 deletions   Show diff stats
ais-structure/src/modules/helper/connection.js
... ... @@ -165,12 +165,14 @@ connection.requestJsonToD01 = async function (obj,cmd,myMethod) {
165 165  
166 166 var resultRes = await asyncRequest(params,objectData,funStats);
167 167  
168   - // console.log(result);
  168 + console.log(resultRes);
169 169 if(resultRes.response)
170 170 {
171 171 var data = JSON.parse(resultRes.response.body);
172 172 result.response = data;
173 173  
  174 + } else {
  175 + result = resultRes;
174 176 }
175 177 }
176 178  
... ... @@ -186,50 +188,18 @@ connection.requestJsonToD01 = async function (obj,cmd,myMethod) {
186 188  
187 189 }
188 190  
189   - // console.log(result);
  191 + console.log(result);
190 192  
191 193 if(result.response)
192 194 {
193   - if(!result.response.resultCode)
  195 + if(!result.response.resultCode){
194 196 result.err = "Missing resultCode";
195   -
196   - if(!result.response.resultDescription)
  197 + } else if(!result.response.resultDescription){
197 198 result.err = "Missing resultDescription";
  199 + }
198 200 }
199 201  
200   -
201   - // if(result.err)
202   - // {
203   - // result.response = {};
204   - // result.response.resultCode = "50000";
205   -
206   - // if(result.err.code == 'ETIMEDOUT'){
207   - // result.response.resultCode = "50003";
208   - // result.response.resultDescription = "Timeout";
209   - // } else if(result.err.code == 'ECONNREFUSED'){
210   - // result.response.resultCode = "50002";
211   - // result.response.resultDescription = "Reject";
212   - // } else {
213   - // if(result.err.indexOf("Missing") != -1){
214   - // result.response.resultCode = "40300";
215   - // result.response.resultDescription = result.err;
216   - // } else {
217   - // result.response.resultCode = "50000";
218   - // result.response.resultDescription = "System error";
219   - // }
220   - // }
221   -
222   - // if(result.response.resultCode == "40300"){
223   - // stats.receiveBadRestResponse(service.Name,params.method,cmd);
224   - // } else {
225   - // stats.receiveResponse(service.Name,cmd,"Error");
226   - // }
227   -
228   - // }
229   -
230 202 return checkResponse(result,service,params,cmd);
231   -
232   -
233 203 };
234 204  
235 205  
... ...