@sap-ux/axios-extension 1.2.3 → 1.2.5
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/dist/abap/message.d.ts
CHANGED
|
@@ -47,18 +47,20 @@ export declare function prettyPrintMessage({ msg, log, host }: {
|
|
|
47
47
|
host?: string;
|
|
48
48
|
}): void;
|
|
49
49
|
/**
|
|
50
|
-
* Log Gateway errors returned from the S_MGW_ODATA_INNER_ERROR table which is a store of OData Inner Error data.
|
|
50
|
+
* Log Gateway errors returned from the S_MGW_ODATA_INNER_ERROR table which is a store of OData Inner Error data. In certain flows,
|
|
51
|
+
* for example, when test mode is enabled, not all error details should be displayed to the user and need to be restricted.
|
|
51
52
|
*
|
|
52
53
|
* @param options options
|
|
53
54
|
* @param options.error error message returned from gateway
|
|
54
55
|
* @param options.log logger to be used
|
|
55
56
|
* @param options.host optional host name to pretty print links
|
|
57
|
+
* @param showAllMessages optional, show all errors but restrict for certain flows i.e. test mode
|
|
56
58
|
*/
|
|
57
59
|
export declare function prettyPrintError({ error, log, host }: {
|
|
58
60
|
error: ErrorMessage;
|
|
59
61
|
log: Logger;
|
|
60
62
|
host?: string;
|
|
61
|
-
}): void;
|
|
63
|
+
}, showAllMessages?: boolean): void;
|
|
62
64
|
/**
|
|
63
65
|
* Print a user friendly time string.
|
|
64
66
|
*
|
package/dist/abap/message.js
CHANGED
|
@@ -41,7 +41,7 @@ function prettyPrintMessage({ msg, log, host }) {
|
|
|
41
41
|
logFullURL({ host, path: jsonMsg['longtext_url'], log });
|
|
42
42
|
if (jsonMsg.details) {
|
|
43
43
|
jsonMsg.details.forEach((entry) => {
|
|
44
|
-
|
|
44
|
+
logLevel(entry.severity, entry.message, log);
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -67,25 +67,29 @@ function logFullURL({ host, path, log }) {
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
70
|
-
* Log Gateway errors returned from the S_MGW_ODATA_INNER_ERROR table which is a store of OData Inner Error data.
|
|
70
|
+
* Log Gateway errors returned from the S_MGW_ODATA_INNER_ERROR table which is a store of OData Inner Error data. In certain flows,
|
|
71
|
+
* for example, when test mode is enabled, not all error details should be displayed to the user and need to be restricted.
|
|
71
72
|
*
|
|
72
73
|
* @param options options
|
|
73
74
|
* @param options.error error message returned from gateway
|
|
74
75
|
* @param options.log logger to be used
|
|
75
76
|
* @param options.host optional host name to pretty print links
|
|
77
|
+
* @param showAllMessages optional, show all errors but restrict for certain flows i.e. test mode
|
|
76
78
|
*/
|
|
77
|
-
function prettyPrintError({ error, log, host }) {
|
|
78
|
-
var _a;
|
|
79
|
+
function prettyPrintError({ error, log, host }, showAllMessages = true) {
|
|
80
|
+
var _a, _b, _c;
|
|
79
81
|
if (error) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
});
|
|
88
|
-
|
|
82
|
+
if (showAllMessages) {
|
|
83
|
+
log.error(((_a = error.message) === null || _a === void 0 ? void 0 : _a.value) || 'An unknown error occurred.');
|
|
84
|
+
}
|
|
85
|
+
(((_b = error.innererror) === null || _b === void 0 ? void 0 : _b.errordetails) || []).forEach((entry) => {
|
|
86
|
+
if (!entry.message.startsWith('<![CDATA')) {
|
|
87
|
+
logLevel(entry.severity, entry.message, log, true);
|
|
88
|
+
}
|
|
89
|
+
logFullURL({ host, path: error['longtext_url'], log });
|
|
90
|
+
});
|
|
91
|
+
if (showAllMessages && ((_c = error.innererror) === null || _c === void 0 ? void 0 : _c.Error_Resolution)) {
|
|
92
|
+
for (const key in error.innererror.Error_Resolution) {
|
|
89
93
|
log.error(`${key}: ${error.innererror.Error_Resolution[key]}`);
|
|
90
94
|
}
|
|
91
95
|
}
|
|
@@ -108,11 +108,12 @@ class Ui5AbapRepositoryService extends odata_service_1.ODataService {
|
|
|
108
108
|
this.log.info(`App available at ${frontendUrl}${path}${query}`);
|
|
109
109
|
}
|
|
110
110
|
else {
|
|
111
|
+
// Test mode returns a HTTP response code of 403 so we dont want to show all error messages
|
|
111
112
|
(0, message_1.prettyPrintError)({
|
|
112
113
|
error: this.getErrorMessageFromString(response === null || response === void 0 ? void 0 : response.data),
|
|
113
114
|
log: this.log,
|
|
114
115
|
host: frontendUrl
|
|
115
|
-
});
|
|
116
|
+
}, false);
|
|
116
117
|
}
|
|
117
118
|
return response;
|
|
118
119
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/axios-extension",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.5",
|
|
4
4
|
"description": "Extension of the Axios module adding convinience methods to interact with SAP systems especially with OData services.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,8 +14,6 @@
|
|
|
14
14
|
"private": false,
|
|
15
15
|
"main": "dist/index.js",
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@sap-ux/btp-utils": "0.11.5",
|
|
18
|
-
"@sap-ux/logger": "0.3.5",
|
|
19
17
|
"axios": "0.24.0",
|
|
20
18
|
"detect-content-type": "1.2.0",
|
|
21
19
|
"fast-xml-parser": "3.12.20",
|
|
@@ -23,7 +21,9 @@
|
|
|
23
21
|
"open": "7.0.3",
|
|
24
22
|
"qs": "6.7.3",
|
|
25
23
|
"xpath": "0.0.32",
|
|
26
|
-
"@xmldom/xmldom": "0.8.6"
|
|
24
|
+
"@xmldom/xmldom": "0.8.6",
|
|
25
|
+
"@sap-ux/btp-utils": "0.11.5",
|
|
26
|
+
"@sap-ux/logger": "0.3.5"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/lodash": "4.14.176",
|