@rsdk/grpc.server 3.5.0-next.7 → 3.5.0-next.8

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/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [3.5.0-next.8](https://github.com/R-Vision/rsdk/compare/v3.5.0-next.7...v3.5.0-next.8) (2023-10-03)
7
+
8
+ ### Features
9
+
10
+ * remove typeorm error hiding ([#126](https://github.com/R-Vision/rsdk/issues/126)) ([cef179b](https://github.com/R-Vision/rsdk/commit/cef179bfffcd2da72984f4a5a750f7ede5d8cfb7))
11
+
6
12
  ## [3.5.0-next.7](https://github.com/R-Vision/rsdk/compare/v3.5.0-next.6...v3.5.0-next.7) (2023-10-02)
7
13
 
8
14
  **Note:** Version bump only for package @rsdk/grpc.server
@@ -6,5 +6,5 @@ export declare class GrpcErrorsFormatter implements IErrorsFormatter {
6
6
  static readonly defaultKind = ExceptionKind.UNKNOWN;
7
7
  private readonly statusMap;
8
8
  match(host: ArgumentsHost): boolean;
9
- format(ex: unknown): FormattedGrpcError;
9
+ format(ex: unknown, verboseErrors?: boolean): FormattedGrpcError;
10
10
  }
@@ -43,21 +43,26 @@ class GrpcErrorsFormatter {
43
43
  match(host) {
44
44
  return host.getType() === 'rpc';
45
45
  }
46
- format(ex) {
46
+ format(ex, verboseErrors) {
47
47
  if (ex instanceof core_1.PipelineException) {
48
- const message = [ex.message, ...core_1.PipelineException.innerMessages(ex)].join(': ');
48
+ const message = verboseErrors
49
+ ? [ex.message, ...core_1.PipelineException.innerMessages(ex)].join(': ')
50
+ : core_1.ExceptionKind[ex.kind].toString();
49
51
  return {
50
52
  code: this.statusMap[ex.kind],
51
53
  message,
52
- details: ex.details,
54
+ details: verboseErrors ? ex.details : {},
53
55
  kind: ex.kind,
54
56
  exceptionCode: ex.code.toString(),
55
57
  };
56
58
  }
59
+ const defaultExMessage = 'UNKNOWN ERROR';
57
60
  return {
58
61
  code: this.statusMap[GrpcErrorsFormatter.defaultKind],
59
- message: ex?.message ?? 'UNKNOWN ERROR',
60
- details: ex?.details,
62
+ message: verboseErrors
63
+ ? ex?.message ?? defaultExMessage
64
+ : defaultExMessage,
65
+ details: verboseErrors ? ex?.details : {},
61
66
  kind: ex?.kind ?? GrpcErrorsFormatter.defaultKind,
62
67
  exceptionCode: ex?.code?.toString(),
63
68
  };
@@ -1 +1 @@
1
- {"version":3,"file":"grpc-errors.formatter.js","sourceRoot":"","sources":["../src/grpc-errors.formatter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAGtC,qCAA8D;AAI9D,MAAa,mBAAmB;IAC9B,MAAM,CAAU,WAAW,GAAG,oBAAa,CAAC,OAAO,CAAC;IACnC,SAAS,GAAuC;QAC/D,CAAC,oBAAa,CAAC,cAAc,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,eAAe;QAC3D,CAAC,oBAAa,CAAC,WAAW,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,iBAAiB;QAC1D,CAAC,oBAAa,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,mBAAmB;QACzD,CAAC,oBAAa,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,gBAAgB;QACnD,CAAC,oBAAa,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,iBAAiB;QACtD,CAAC,oBAAa,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ;QAC9C,CAAC,oBAAa,CAAC,WAAW,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,cAAc;QACvD,CAAC,oBAAa,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS;QAChD,CAAC,oBAAa,CAAC,WAAW,CAAC,EAAE,IAAI,CAAC,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,OAAO;gBACP,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;gBACxC,IAAI,EAAE,EAAE,CAAC,IAAI;gBACb,aAAa,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE;aAClC,CAAC;SACH;QAED,MAAM,gBAAgB,GAAG,eAAe,CAAC;QAEzC,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,mBAAmB,CAAC,WAAW,CAAC;YACrD,OAAO,EAAE,aAAa;gBACpB,CAAC,CAAE,EAAU,EAAE,OAAO,IAAI,gBAAgB;gBAC1C,CAAC,CAAC,gBAAgB;YACpB,OAAO,EAAE,aAAa,CAAC,CAAC,CAAE,EAAU,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE;YAClD,IAAI,EAAG,EAAU,EAAE,IAAI,IAAI,mBAAmB,CAAC,WAAW;YAC1D,aAAa,EAAG,EAAU,EAAE,IAAI,EAAE,QAAQ,EAAE;SAC7C,CAAC;IACJ,CAAC;;AA7CH,kDA8CC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsdk/grpc.server",
3
- "version": "3.5.0-next.7",
3
+ "version": "3.5.0-next.8",
4
4
  "description": "Grpc transport for platform, clients and common grpc stuff",
5
5
  "license": "Apache License 2.0",
6
6
  "publishConfig": {
@@ -27,5 +27,5 @@
27
27
  "nice-grpc-opentelemetry": "^0.1.3",
28
28
  "rxjs": "^7.0.0"
29
29
  },
30
- "gitHead": "d45507843068602defe1eabcd11a918aaa837d39"
30
+ "gitHead": "52791062dcfed674101ccbf44079a21a2df64c72"
31
31
  }
@@ -24,25 +24,29 @@ export class GrpcErrorsFormatter implements IErrorsFormatter {
24
24
  return host.getType() === 'rpc';
25
25
  }
26
26
 
27
- format(ex: unknown): FormattedGrpcError {
27
+ format(ex: unknown, verboseErrors?: boolean): FormattedGrpcError {
28
28
  if (ex instanceof PipelineException) {
29
- const message = [ex.message, ...PipelineException.innerMessages(ex)].join(
30
- ': ',
31
- );
29
+ const message = verboseErrors
30
+ ? [ex.message, ...PipelineException.innerMessages(ex)].join(': ')
31
+ : ExceptionKind[ex.kind].toString();
32
32
 
33
33
  return {
34
34
  code: this.statusMap[ex.kind],
35
35
  message,
36
- details: ex.details,
36
+ details: verboseErrors ? ex.details : {},
37
37
  kind: ex.kind,
38
38
  exceptionCode: ex.code.toString(),
39
39
  };
40
40
  }
41
41
 
42
+ const defaultExMessage = 'UNKNOWN ERROR';
43
+
42
44
  return {
43
45
  code: this.statusMap[GrpcErrorsFormatter.defaultKind],
44
- message: (ex as any)?.message ?? 'UNKNOWN ERROR',
45
- details: (ex as any)?.details,
46
+ message: verboseErrors
47
+ ? (ex as any)?.message ?? defaultExMessage
48
+ : defaultExMessage,
49
+ details: verboseErrors ? (ex as any)?.details : {},
46
50
  kind: (ex as any)?.kind ?? GrpcErrorsFormatter.defaultKind,
47
51
  exceptionCode: (ex as any)?.code?.toString(),
48
52
  };