@nmxjs/app 1.0.91 → 1.0.92

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.
@@ -1,4 +1,4 @@
1
1
  import { ExceptionFilter } from '@nestjs/common';
2
2
  export declare class GqlExceptionFilter implements ExceptionFilter {
3
- catch(error: any): void;
3
+ catch(error: any, host: any): any;
4
4
  }
@@ -11,10 +11,15 @@ const graphql_1 = require("graphql");
11
11
  const common_1 = require("@nestjs/common");
12
12
  const errors_1 = require("@nmxjs/errors");
13
13
  let GqlExceptionFilter = class GqlExceptionFilter {
14
- catch(error) {
14
+ catch(error, host) {
15
15
  if (error.code === '23505') {
16
16
  error = new errors_1.AlreadyExistError();
17
17
  }
18
+ if (error instanceof common_1.NotFoundException) {
19
+ const ctx = host.switchToHttp();
20
+ const res = ctx.getResponse();
21
+ return res.status(404).json({ message: { statusCode: 404, error: 'Not Found', message: error.message } });
22
+ }
18
23
  throw new graphql_1.GraphQLError(error.message, {
19
24
  extensions: {
20
25
  code: error.code,
@@ -1 +1 @@
1
- {"version":3,"file":"GqlExceptionFilter.js","sourceRoot":"","sources":["../src/GqlExceptionFilter.ts"],"names":[],"mappings":";;;;;;;;;AAAA,qCAAuC;AACvC,2CAAwD;AACxD,0CAAkD;AAG3C,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IACtB,KAAK,CAAC,KAAK;QAChB,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YAC3B,KAAK,GAAG,IAAI,0BAAiB,EAAE,CAAC;QAClC,CAAC;QAED,MAAM,IAAI,sBAAY,CAAC,KAAK,CAAC,OAAO,EAAE;YACpC,UAAU,EAAE;gBACV,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,IAAI,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,UAAU,IAAI,GAAG,EAAE;aAC1C;SACF,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AAbY,gDAAkB;6BAAlB,kBAAkB;IAD9B,IAAA,cAAK,GAAE;GACK,kBAAkB,CAa9B"}
1
+ {"version":3,"file":"GqlExceptionFilter.js","sourceRoot":"","sources":["../src/GqlExceptionFilter.ts"],"names":[],"mappings":";;;;;;;;;AAAA,qCAAuC;AACvC,2CAA2E;AAC3E,0CAAkD;AAG3C,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IACtB,KAAK,CAAC,KAAK,EAAE,IAAI;QACtB,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YAC3B,KAAK,GAAG,IAAI,0BAAiB,EAAE,CAAC;QAClC,CAAC;QAED,IAAI,KAAK,YAAY,0BAAiB,EAAE,CAAC;YACvC,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;YAChC,MAAM,GAAG,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;YAC9B,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAC5G,CAAC;QAED,MAAM,IAAI,sBAAY,CAAC,KAAK,CAAC,OAAO,EAAE;YACpC,UAAU,EAAE;gBACV,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,IAAI,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,UAAU,IAAI,GAAG,EAAE;aAC1C;SACF,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AAnBY,gDAAkB;6BAAlB,kBAAkB;IAD9B,IAAA,cAAK,GAAE;GACK,kBAAkB,CAmB9B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nmxjs/app",
3
- "version": "1.0.91",
3
+ "version": "1.0.92",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",