@be-link/shield-for-tcb-node-sdk 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/utils/http.js +4 -4
package/package.json
CHANGED
package/utils/http.js
CHANGED
|
@@ -56,8 +56,8 @@ const axios_retry_1 = __importDefault(require("axios-retry"));
|
|
|
56
56
|
async function callApi(url, request, options) {
|
|
57
57
|
const requestId = (0, uuid_1.v4)();
|
|
58
58
|
try {
|
|
59
|
-
console.info(`准备发起
|
|
60
|
-
const response = await axios_1.default.post(url, request, {
|
|
59
|
+
console.info(`准备发起shield-for-tcb请求[${requestId}]: ${url}, 参数: ${JSON.stringify(request)}`);
|
|
60
|
+
const response = await axios_1.default.post(url, request || {}, {
|
|
61
61
|
headers: { 'x-request-id': requestId, 'content-type': 'application/json' },
|
|
62
62
|
});
|
|
63
63
|
const responseData = response.data;
|
|
@@ -71,7 +71,7 @@ async function callApi(url, request, options) {
|
|
|
71
71
|
if (axiosError.response) {
|
|
72
72
|
const response = axiosError.response;
|
|
73
73
|
const data = response.data;
|
|
74
|
-
console.error(`
|
|
74
|
+
console.error(`shield-for-tcb 异常: ${axiosError.message}, requestId: ${requestId}`);
|
|
75
75
|
console.info('响应信息', data.message);
|
|
76
76
|
console.error('异常堆栈', JSON.stringify(error.stack));
|
|
77
77
|
throw new Error(data.errorType + ' - ' + data.message);
|
|
@@ -95,7 +95,7 @@ async function callApi(url, request, options) {
|
|
|
95
95
|
catch (error) {
|
|
96
96
|
console.info(`error: ${JSON.stringify(error)}`);
|
|
97
97
|
}
|
|
98
|
-
console.error(`
|
|
98
|
+
console.error(`shield-for-tcb 未知异常: ${axiosError.message}`, error.stack);
|
|
99
99
|
throw error;
|
|
100
100
|
}
|
|
101
101
|
}
|