@gravity-ui/gateway 1.0.5 → 1.1.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/README.md +1 -1
- package/build/components/mixed.js +3 -3
- package/build/utils/common.js +4 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @gravity-ui/gateway · [](https://www.npmjs.com/package/@gravity-ui/gateway) [](https://github.com/gravity-ui/gateway/actions/workflows/ci.yml?query=branch:main)
|
|
2
2
|
|
|
3
|
-
Express controller for working with REST/GRPC APIs
|
|
3
|
+
Express controller for working with REST/GRPC APIs.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -45,17 +45,17 @@ function createMixedAction(config, api, serviceName, actionName, extra, ErrorCon
|
|
|
45
45
|
}
|
|
46
46
|
if (e instanceof Error) {
|
|
47
47
|
const parsedError = (0, parse_error_1.parseMixedError)(e);
|
|
48
|
-
|
|
48
|
+
(0, common_1.handleError)(ErrorConstructor, e, ctx, 'Request failed', {
|
|
49
49
|
actionName,
|
|
50
50
|
serviceName,
|
|
51
|
-
parsedError,
|
|
52
51
|
});
|
|
53
52
|
throw {
|
|
54
53
|
error: parsedError,
|
|
55
54
|
};
|
|
56
55
|
}
|
|
56
|
+
(0, common_1.handleError)(ErrorConstructor, e, ctx, 'Request failed');
|
|
57
57
|
throw {
|
|
58
|
-
error:
|
|
58
|
+
error: e,
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
61
|
finally {
|
package/build/utils/common.js
CHANGED
|
@@ -43,8 +43,11 @@ function handleError(ErrorConstructor, error, ctx, message, extra) {
|
|
|
43
43
|
if (error instanceof Error) {
|
|
44
44
|
ctx.logError(message, ErrorConstructor.wrap(error), extra);
|
|
45
45
|
}
|
|
46
|
+
else if (typeof error === 'string') {
|
|
47
|
+
ctx.logError(message, { error }, extra);
|
|
48
|
+
}
|
|
46
49
|
else {
|
|
47
|
-
ctx.logError(message,
|
|
50
|
+
ctx.logError(message, error, extra);
|
|
48
51
|
}
|
|
49
52
|
}
|
|
50
53
|
exports.handleError = handleError;
|