@sap/cds-dk 7.5.0 → 7.5.1
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/lib/bind/cfKeyProvider.js +1 -1
- package/lib/build/provider/mtx-extension/index.js +2 -1
- package/lib/compile/openapi/csdl2openapi.js +1 -1
- package/lib/mtx/activate.js +1 -1
- package/lib/mtx/auth_manager.js +1 -1
- package/lib/mtx/download_legacy.js +1 -1
- package/lib/mtx/extend.js +1 -1
- package/lib/mtx/pull.js +1 -1
- package/lib/mtx/push.js +1 -1
- package/lib/mtx/tenant_action.js +1 -1
- package/lib/mtx/util/legacy_ext.js +1 -1
- package/lib/util/axios.js +84 -0
- package/npm-shrinkwrap.json +593 -427
- package/package.json +1 -1
- package/lib/util/pruneAxiosErrors.js +0 -56
package/package.json
CHANGED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
function stacklessError(message) {
|
|
2
|
-
const { stackTraceLimit } = Error;
|
|
3
|
-
Error.stackTraceLimit = 0;
|
|
4
|
-
const error = new Error(message);
|
|
5
|
-
Error.stackTraceLimit = stackTraceLimit;
|
|
6
|
-
return error;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
require('axios').interceptors.response.use(
|
|
10
|
-
response => response,
|
|
11
|
-
axError => {
|
|
12
|
-
const { inspect } = require('util');
|
|
13
|
-
const { url, method } = axError.config ?? {};
|
|
14
|
-
const { errno, code, response = {} } = axError;
|
|
15
|
-
const prefix = (url && method ? `${method.toUpperCase()} ${url} ` : '') + 'failed';
|
|
16
|
-
|
|
17
|
-
let error;
|
|
18
|
-
if (errno) {
|
|
19
|
-
// System error during request.
|
|
20
|
-
const message = prefix
|
|
21
|
-
+ `: ${errno} ${code}`
|
|
22
|
-
+ (code === 'ENOTFOUND' ? `. Make sure the URL is correct and the server is running.` : '');
|
|
23
|
-
error = stacklessError(message);
|
|
24
|
-
} else {
|
|
25
|
-
// Error after request has been made.
|
|
26
|
-
const { status, statusText } = response;
|
|
27
|
-
let { data } = response;
|
|
28
|
-
if (Buffer.isBuffer(data)) {
|
|
29
|
-
data = data.toString();
|
|
30
|
-
try {
|
|
31
|
-
data = JSON.parse(data);
|
|
32
|
-
} catch (error) { /* unexpected; data will be included in error below */
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
const inspectData = data && !data.error_description;
|
|
36
|
-
const reason = !inspectData && data?.error /* RFC 6749 */ && (typeof data.error === 'string' ? data.error : inspect(data.error));
|
|
37
|
-
const details = inspectData ? inspect(data) : data?.error_description /* RFC 6749 */;
|
|
38
|
-
const message = prefix +
|
|
39
|
-
(status || statusText ? ':' : '') +
|
|
40
|
-
(status ? ` ${status}` : '') +
|
|
41
|
-
(statusText ? ` ${statusText}` : '') +
|
|
42
|
-
(reason ? `. ${reason}` : '') +
|
|
43
|
-
(details ? `. Details: ${details}` : '');
|
|
44
|
-
|
|
45
|
-
error = stacklessError(message);
|
|
46
|
-
if (status) {
|
|
47
|
-
error.status = status;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (require('../').debug('req')) {
|
|
52
|
-
error.cause = axError;
|
|
53
|
-
}
|
|
54
|
-
return Promise.reject(error);
|
|
55
|
-
}
|
|
56
|
-
);
|