@alipay/ams-checkout 0.0.1755258862-dev.2 → 0.0.1755258862-dev.3
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.
@@ -46,7 +46,7 @@ export var RequesterService = /*#__PURE__*/function () {
|
|
46
46
|
key: "request",
|
47
47
|
value: (function () {
|
48
48
|
var _request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(requestData, options) {
|
49
|
-
var envInfo, _data, startTime, traceId, myRequest, data, headers,
|
49
|
+
var envInfo, _data, startTime, traceId, myRequest, _yield$myRequest, data, headers, resData, handleGetWayError, errorMessage, errorCode, _error$message, _error, timeoutCode, _errorCode;
|
50
50
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
51
51
|
while (1) switch (_context.prev = _context.next) {
|
52
52
|
case 0:
|
@@ -64,25 +64,16 @@ export var RequesterService = /*#__PURE__*/function () {
|
|
64
64
|
console.log('[DEBUG] createRequestInstance start');
|
65
65
|
myRequest = this.createRequestInstance(options);
|
66
66
|
console.log('[DEBUG] createRequestInstance completed', myRequest);
|
67
|
-
_context.prev = 9;
|
68
67
|
console.log('[DEBUG] myRequest start');
|
69
|
-
_context.next =
|
68
|
+
_context.next = 12;
|
70
69
|
return myRequest({
|
71
70
|
data: _data
|
72
71
|
});
|
73
|
-
case
|
74
|
-
|
75
|
-
data =
|
76
|
-
headers =
|
72
|
+
case 12:
|
73
|
+
_yield$myRequest = _context.sent;
|
74
|
+
data = _yield$myRequest.data;
|
75
|
+
headers = _yield$myRequest.headers;
|
77
76
|
console.log('[DEBUG] myRequest completed', data, headers);
|
78
|
-
_context.next = 23;
|
79
|
-
break;
|
80
|
-
case 19:
|
81
|
-
_context.prev = 19;
|
82
|
-
_context.t0 = _context["catch"](9);
|
83
|
-
console.error('[DEBUG] myRequest failed', _context.t0);
|
84
|
-
throw _context.t0;
|
85
|
-
case 23:
|
86
77
|
resData = data || {};
|
87
78
|
traceId = get(headers, 'Mgw-TraceId') || get(headers, 'mgw-traceid', '');
|
88
79
|
resData.traceId = traceId || '';
|
@@ -90,7 +81,7 @@ export var RequesterService = /*#__PURE__*/function () {
|
|
90
81
|
handleGetWayError = fomatGetwayError(headers, traceId);
|
91
82
|
console.log('[DEBUG] handleGetWayError completed', handleGetWayError);
|
92
83
|
if (!(handleGetWayError !== null && handleGetWayError !== void 0 && handleGetWayError.errorCode)) {
|
93
|
-
_context.next =
|
84
|
+
_context.next = 29;
|
94
85
|
break;
|
95
86
|
}
|
96
87
|
console.log('[DEBUG] handleGetWayError errorCode', handleGetWayError === null || handleGetWayError === void 0 ? void 0 : handleGetWayError.errorCode);
|
@@ -116,7 +107,7 @@ export var RequesterService = /*#__PURE__*/function () {
|
|
116
107
|
errorCode: errorCode,
|
117
108
|
success: false
|
118
109
|
}));
|
119
|
-
case
|
110
|
+
case 29:
|
120
111
|
this.reportRequestTimeCost({
|
121
112
|
title: 'a3753.b101271.c388193.d521387',
|
122
113
|
name: options === null || options === void 0 ? void 0 : options['Operation-Type'],
|
@@ -129,17 +120,17 @@ export var RequesterService = /*#__PURE__*/function () {
|
|
129
120
|
});
|
130
121
|
console.log('[DEBUG] request completed', resData);
|
131
122
|
return _context.abrupt("return", resData);
|
132
|
-
case
|
133
|
-
_context.prev =
|
134
|
-
_context.
|
135
|
-
_error = safeJson(_context.
|
123
|
+
case 34:
|
124
|
+
_context.prev = 34;
|
125
|
+
_context.t0 = _context["catch"](5);
|
126
|
+
_error = safeJson(_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message, {
|
136
127
|
success: false,
|
137
128
|
errorCode: errorEnum.SYSTEM,
|
138
129
|
traceId: traceId,
|
139
|
-
errorMessage: _context.
|
130
|
+
errorMessage: _context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message
|
140
131
|
});
|
141
|
-
console.log('[DEBUG] request error 1', _error, 'Original error:', _context.
|
142
|
-
timeoutCode = _context.
|
132
|
+
console.log('[DEBUG] request error 1', _error, 'Original error:', _context.t0);
|
133
|
+
timeoutCode = _context.t0 !== null && _context.t0 !== void 0 && (_error$message = _context.t0.message) !== null && _error$message !== void 0 && _error$message.includes('timeout') ? errorEnum.TIMEOUT : '';
|
143
134
|
_errorCode = (_error === null || _error === void 0 ? void 0 : _error.errorCode) || timeoutCode;
|
144
135
|
this.reportRequestTimeCost({
|
145
136
|
title: 'a3753.b101271.c388193.d521387',
|
@@ -148,7 +139,7 @@ export var RequesterService = /*#__PURE__*/function () {
|
|
148
139
|
time: Date.now() - startTime,
|
149
140
|
success: false,
|
150
141
|
code: _errorCode,
|
151
|
-
msg: JSON.stringify((_error === null || _error === void 0 ? void 0 : _error.message) || _context.
|
142
|
+
msg: JSON.stringify((_error === null || _error === void 0 ? void 0 : _error.message) || _context.t0)
|
152
143
|
});
|
153
144
|
console.log('[DEBUG] request error 2', {
|
154
145
|
success: false,
|
@@ -162,11 +153,11 @@ export var RequesterService = /*#__PURE__*/function () {
|
|
162
153
|
traceId: traceId,
|
163
154
|
errorMessage: _error === null || _error === void 0 ? void 0 : _error.message
|
164
155
|
}));
|
165
|
-
case
|
156
|
+
case 43:
|
166
157
|
case "end":
|
167
158
|
return _context.stop();
|
168
159
|
}
|
169
|
-
}, _callee, this, [[5,
|
160
|
+
}, _callee, this, [[5, 34]]);
|
170
161
|
}));
|
171
162
|
function request(_x, _x2) {
|
172
163
|
return _request.apply(this, arguments);
|