@rsdk/graphql 6.0.0-next.19 → 6.0.0-next.20
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.
|
@@ -4,7 +4,6 @@ exports.GraphQLErrorsFormatter = void 0;
|
|
|
4
4
|
const common_1 = require("@rsdk/common");
|
|
5
5
|
const core_1 = require("@rsdk/core");
|
|
6
6
|
const graphql_1 = require("graphql");
|
|
7
|
-
const ALWAYS_VERBOSE = new Set([core_1.ExceptionKind.INPUT]);
|
|
8
7
|
const DEFAULT_MESSAGE = 'Something went wrong';
|
|
9
8
|
/**
|
|
10
9
|
* Форматирование ошибок происходит в 2 этапа:
|
|
@@ -37,9 +36,8 @@ class GraphQLErrorsFormatter {
|
|
|
37
36
|
}
|
|
38
37
|
format(ex, verbose) {
|
|
39
38
|
if (ex instanceof core_1.PipelineException) {
|
|
40
|
-
const formatVerbose = verbose || ALWAYS_VERBOSE.has(ex.kind);
|
|
41
39
|
const { kind, code, details, cause } = ex;
|
|
42
|
-
const message =
|
|
40
|
+
const message = verbose
|
|
43
41
|
? [ex.message, ...core_1.PipelineException.innerMessages(ex)].join(' > ')
|
|
44
42
|
: DEFAULT_MESSAGE;
|
|
45
43
|
return new graphql_1.GraphQLError(message, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql-errors.formatter.js","sourceRoot":"","sources":["../../src/error-handling/graphql-errors.formatter.ts"],"names":[],"mappings":";;;AAAA,yCAAyD;AAEzD,qCAA8D;AAE9D,qCAAuC;AAEvC,MAAM,
|
|
1
|
+
{"version":3,"file":"graphql-errors.formatter.js","sourceRoot":"","sources":["../../src/error-handling/graphql-errors.formatter.ts"],"names":[],"mappings":";;;AAAA,yCAAyD;AAEzD,qCAA8D;AAE9D,qCAAuC;AAEvC,MAAM,eAAe,GAAG,sBAAsB,CAAC;AAE/C;;;;;;;GAOG;AACH,MAAa,sBAAsB;IACjC,QAAQ,GAAG,SAAS,CAAC;IAErB,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CAAC,CAAC;YAC7C,CAAC,CAAC,eAAe,CAAC;QAEpB,OAAO,IAAI,sBAAY,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;CACF;AA3DD,wDA2DC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdk/graphql",
|
|
3
|
-
"version": "6.0.0-next.
|
|
3
|
+
"version": "6.0.0-next.20",
|
|
4
4
|
"description": "Plugin for graphql",
|
|
5
5
|
"license": "Apache License 2.0",
|
|
6
6
|
"publishConfig": {
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
"reflect-metadata": "^0.1.12 || ^0.2.0",
|
|
30
30
|
"rxjs": "^7.8.1"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "8967e1d9b691808f5e0b4c6d6dff0fefae3b2c32"
|
|
33
33
|
}
|
|
@@ -4,7 +4,6 @@ import { ExceptionKind, PipelineException } from '@rsdk/core';
|
|
|
4
4
|
import type { GraphQLFormattedError } from 'graphql';
|
|
5
5
|
import { GraphQLError } from 'graphql';
|
|
6
6
|
|
|
7
|
-
const ALWAYS_VERBOSE = new Set([ExceptionKind.INPUT]);
|
|
8
7
|
const DEFAULT_MESSAGE = 'Something went wrong';
|
|
9
8
|
|
|
10
9
|
/**
|
|
@@ -45,11 +44,9 @@ export class GraphQLErrorsFormatter implements IErrorsFormatter {
|
|
|
45
44
|
|
|
46
45
|
format(ex: unknown, verbose?: boolean): GraphQLError {
|
|
47
46
|
if (ex instanceof PipelineException) {
|
|
48
|
-
const formatVerbose = verbose || ALWAYS_VERBOSE.has(ex.kind);
|
|
49
|
-
|
|
50
47
|
const { kind, code, details, cause } = ex;
|
|
51
48
|
|
|
52
|
-
const message =
|
|
49
|
+
const message = verbose
|
|
53
50
|
? [ex.message, ...PipelineException.innerMessages(ex)].join(' > ')
|
|
54
51
|
: DEFAULT_MESSAGE;
|
|
55
52
|
|