@gravity-ui/gateway 1.0.5 → 1.1.0

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.
@@ -45,7 +45,7 @@ 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
- ctx.logError('Request failed', ErrorConstructor.wrap(e), {
48
+ (0, common_1.handleError)(ErrorConstructor, e, ctx, 'Request failed', {
49
49
  actionName,
50
50
  serviceName,
51
51
  parsedError,
@@ -54,8 +54,9 @@ function createMixedAction(config, api, serviceName, actionName, extra, ErrorCon
54
54
  error: parsedError,
55
55
  };
56
56
  }
57
+ (0, common_1.handleError)(ErrorConstructor, e, ctx, 'Request failed');
57
58
  throw {
58
- error: JSON.stringify(e),
59
+ error: e,
59
60
  };
60
61
  }
61
62
  finally {
@@ -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, JSON.stringify(error), extra);
50
+ ctx.logError(message, error, extra);
48
51
  }
49
52
  }
50
53
  exports.handleError = handleError;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/gateway",
3
- "version": "1.0.5",
3
+ "version": "1.1.0",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "main": "build/index.js",