Authored by weiqingting

提交

... ... @@ -117,7 +117,7 @@ function __requestApi(config, apiOpt, req, callback) {
Request(options, function (error, response, body) {
var _err_ = new Error();
if (error) {
console.info("Error [request]:" + options.title);
console.info("Error [request"+options.url+"]:" + options.title);
console.error(error);
return callback(error, null);
}
... ... @@ -125,20 +125,20 @@ function __requestApi(config, apiOpt, req, callback) {
if (response && response.statusCode === 200) {
var obj = JSON.parse(body)
if (!(typeof obj == "object")) {
_err_.message = "Error[json parse@" + options.title + "]:" + body;
_err_.message = "Error[json parse@" + options.title + "--"+options.url+"]:" + body;
console.info(_err_.message);
console.error(_err_);
return callback(_err_, null);
}
} else {
_err_.message = "Error[response state @" + options.title + "]:" + response;
_err_.message = "Error[response state @" + options.title + "--"+options.url+"]:" + response;
console.info(_err_.message);
console.error(_err_);
return callback(_err_, null);
}
} catch (err) {
console.info("Error[response to json @" + options.title + "]");
console.info("Error[response to json @" + options.title + "--"+options.url+"]");
console.info(response);
console.error(err);
return callback(err, null);
... ... @@ -336,7 +336,7 @@ function __sendRequest(options, success, fail,wlen,i,args) {
Request(options, function (error, response, body) {
var _err_ = new Error(), obj;
if (error) {
console.info("Error [request]:" + options.title);
console.info("Error [request"+options.url+"]:" + options.title);
console.error(error);
fail && fail(error);
return;
... ... @@ -346,7 +346,7 @@ function __sendRequest(options, success, fail,wlen,i,args) {
if (!options.outobj) {
obj = JSON.parse(body)
if (!(typeof obj == "object")) {
_err_.message = "Error[json parse@" + options.title + "]:" + body;
_err_.message = "Error[json parse@" + options.title + "--"+options.url+"]:" + body;
console.info(_err_.message);
console.error(_err_);
fail && fail(_err_);
... ... @@ -356,7 +356,7 @@ function __sendRequest(options, success, fail,wlen,i,args) {
obj = options.outobj.toLocaleUpperCase().indexOf("BODY")>-1?body:response;
}
} else {
_err_.message = "Error[response state @" + options.title + "]:" + response;
_err_.message = "Error[response state @" + options.title + "--"+options.url+"]:" + response;
console.info(_err_.message);
console.error(_err_);
fail && fail(_err_);
... ... @@ -364,7 +364,7 @@ function __sendRequest(options, success, fail,wlen,i,args) {
}
} catch (err) {
console.info("Error[response to json @" + options.title + "]");
console.info("Error[response to json @" + options.title + "--"+options.url+"]");
console.info(response);
console.error(err);
fail && fail(err);
... ...
... ... @@ -117,7 +117,7 @@ function __requestApi(config, apiOpt, req, callback) {
Request(options, function (error, response, body) {
var _err_ = new Error();
if (error) {
console.info("Error [request]:" + options.title);
console.info("Error [request"+options.url+"]:" + options.title);
console.error(error);
return callback(error, null);
}
... ... @@ -125,20 +125,20 @@ function __requestApi(config, apiOpt, req, callback) {
if (response && response.statusCode === 200) {
var obj = JSON.parse(body)
if (!(typeof obj == "object")) {
_err_.message = "Error[json parse@" + options.title + "]:" + body;
_err_.message = "Error[json parse@" + options.title + "--"+options.url+"]:" + body;
console.info(_err_.message);
console.error(_err_);
return callback(_err_, null);
}
} else {
_err_.message = "Error[response state @" + options.title + "]:" + response;
_err_.message = "Error[response state @" + options.title + "--"+options.url+"]:" + response;
console.info(_err_.message);
console.error(_err_);
return callback(_err_, null);
}
} catch (err) {
console.info("Error[response to json @" + options.title + "]");
console.info("Error[response to json @" + options.title + "--"+options.url+"]");
console.info(response);
console.error(err);
return callback(err, null);
... ... @@ -336,7 +336,7 @@ function __sendRequest(options, success, fail,wlen,i,args) {
Request(options, function (error, response, body) {
var _err_ = new Error(), obj;
if (error) {
console.info("Error [request]:" + options.title);
console.info("Error [request"+options.url+"]:" + options.title);
console.error(error);
fail && fail(error);
return;
... ... @@ -346,7 +346,7 @@ function __sendRequest(options, success, fail,wlen,i,args) {
if (!options.outobj) {
obj = JSON.parse(body)
if (!(typeof obj == "object")) {
_err_.message = "Error[json parse@" + options.title + "]:" + body;
_err_.message = "Error[json parse@" + options.title + "--"+options.url+"]:" + body;
console.info(_err_.message);
console.error(_err_);
fail && fail(_err_);
... ... @@ -356,7 +356,7 @@ function __sendRequest(options, success, fail,wlen,i,args) {
obj = options.outobj.toLocaleUpperCase().indexOf("BODY")>-1?body:response;
}
} else {
_err_.message = "Error[response state @" + options.title + "]:" + response;
_err_.message = "Error[response state @" + options.title + "--"+options.url+"]:" + response;
console.info(_err_.message);
console.error(_err_);
fail && fail(_err_);
... ... @@ -364,7 +364,7 @@ function __sendRequest(options, success, fail,wlen,i,args) {
}
} catch (err) {
console.info("Error[response to json @" + options.title + "]");
console.info("Error[response to json @" + options.title + "--"+options.url+"]");
console.info(response);
console.error(err);
fail && fail(err);
... ...