@nest-yalc-2/errors 1.3.4 → 2.0.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.
- package/package.json +5 -5
- package/src/__tests__/database-exception.filter.spec.ts +1 -1
- package/src/__tests__/default.error.spec.ts +1 -1
- package/src/__tests__/errors.enum.spec.ts +1 -1
- package/src/__tests__/http-exception.filter.spec.ts +54 -1
- package/src/__tests__/http-status-code-to-errors.spec.ts +1 -1
- package/src/__tests__/input-validation.error.spec.ts +1 -1
- package/src/__tests__/login.error.spec.ts +1 -1
- package/src/__tests__/system-exception.filter.spec.ts +1 -1
- package/src/__tests__/verification.error.spec.ts +1 -1
- package/src/filters/database-exception.filter.d.ts +2 -1
- package/src/filters/database-exception.filter.js +5 -46
- package/src/filters/database-exception.filter.js.map +1 -1
- package/src/filters/database-exception.filter.ts +4 -2
- package/src/filters/http-exception.filter.d.ts +4 -3
- package/src/filters/http-exception.filter.js +5 -46
- package/src/filters/http-exception.filter.js.map +1 -1
- package/src/filters/http-exception.filter.ts +4 -3
- package/src/filters/system-exception.filter.js +4 -12
- package/src/filters/system-exception.filter.js.map +1 -1
- package/src/filters/system-exception.filter.ts +1 -1
- package/src/filters/validation-exception.filter.d.ts +2 -2
- package/src/filters/validation-exception.filter.js +4 -45
- package/src/filters/validation-exception.filter.js.map +1 -1
- package/src/filters/validation-exception.filter.ts +3 -1
- package/src/index.d.ts +2 -4
- package/src/index.js +3 -18
- package/src/index.js.map +1 -1
- package/src/index.ts +2 -4
- package/src/default.error.d.ts +0 -93
- package/src/default.error.js +0 -266
- package/src/default.error.js.map +0 -1
- package/src/default.error.ts +0 -640
- package/src/error.class.d.ts +0 -103
- package/src/error.class.js +0 -170
- package/src/error.class.js.map +0 -1
- package/src/error.class.ts +0 -319
- package/src/error.enum.d.ts +0 -29
- package/src/error.enum.js +0 -41
- package/src/error.enum.js.map +0 -1
- package/src/error.enum.ts +0 -45
- package/src/error.helper.d.ts +0 -2
- package/src/error.helper.js +0 -20
- package/src/error.helper.js.map +0 -1
- package/src/error.helper.ts +0 -34
- package/src/http-status-code-to-errors.d.ts +0 -4
- package/src/http-status-code-to-errors.js +0 -24
- package/src/http-status-code-to-errors.js.map +0 -1
- package/src/http-status-code-to-errors.ts +0 -41
- package/src/result.error.d.ts +0 -4
- package/src/result.error.js +0 -24
- package/src/result.error.js.map +0 -1
- package/src/result.error.ts +0 -25
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nest-yalc-2/errors",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
"src"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@nest-yalc-2/crud-gen": "^
|
|
21
|
-
"@nest-yalc-2/event-manager": "^
|
|
22
|
-
"@nest-yalc-2/logger": "^
|
|
23
|
-
"@nest-yalc-2/utils": "^
|
|
20
|
+
"@nest-yalc-2/crud-gen": "^2.0.0",
|
|
21
|
+
"@nest-yalc-2/event-manager": "^2.0.0",
|
|
22
|
+
"@nest-yalc-2/logger": "^2.0.0",
|
|
23
|
+
"@nest-yalc-2/utils": "^2.0.0",
|
|
24
24
|
"axios": "^1.15.0",
|
|
25
25
|
"neverthrow": "^8.2.0",
|
|
26
26
|
"tslib": "^2.6.3"
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
} from '@nestjs/common';
|
|
17
17
|
import { EntityTarget } from 'typeorm';
|
|
18
18
|
import { ConnectionNotFoundError, EntityNotFoundError } from 'typeorm';
|
|
19
|
-
import { ExceptionContextEnum } from '
|
|
19
|
+
import { ExceptionContextEnum } from '@node-yalc/errors/error.enum.js';
|
|
20
20
|
import { DatabaseExceptionFilter } from '../filters/database-exception.filter.js';
|
|
21
21
|
|
|
22
22
|
import { GqlArgumentsHost } from '@nestjs/graphql';
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
HttpException,
|
|
18
18
|
HttpStatus,
|
|
19
19
|
} from '@nestjs/common';
|
|
20
|
-
import { getHttpStatusDescription } from '@
|
|
20
|
+
import { getHttpStatusDescription } from '@node-yalc/utils/http.helper.js';
|
|
21
21
|
|
|
22
22
|
describe('DefaultErrorMixin', () => {
|
|
23
23
|
it('should create a class that extends Error when no base class is provided', () => {
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
afterAll,
|
|
9
9
|
afterEach,
|
|
10
10
|
} from '@jest/globals';
|
|
11
|
-
import { ErrorsEnum, ExceptionContextEnum } from '
|
|
11
|
+
import { ErrorsEnum, ExceptionContextEnum } from '@node-yalc/errors/error.enum.js';
|
|
12
12
|
|
|
13
13
|
describe('errors enum test', () => {
|
|
14
14
|
it('ErrorsEnum should have all the values', () => {
|
|
@@ -97,25 +97,78 @@ describe('Http exceptions filter', () => {
|
|
|
97
97
|
expect(loggerServiceMock.error).toHaveBeenCalledWith(exception.message);
|
|
98
98
|
});
|
|
99
99
|
|
|
100
|
-
it('should catch and log Http error with host type http', () => {
|
|
100
|
+
it('should catch and log Http error with host type http and send response', () => {
|
|
101
101
|
const exception = new InternalServerErrorException();
|
|
102
102
|
mockArgumentsHost.getType.mockReturnValue('http');
|
|
103
|
+
const mockResponse = {
|
|
104
|
+
status: jest.fn().mockReturnThis(),
|
|
105
|
+
send: jest.fn(),
|
|
106
|
+
};
|
|
107
|
+
mockArgumentsHost.switchToHttp.mockReturnValue({
|
|
108
|
+
getResponse: () => mockResponse,
|
|
109
|
+
getRequest: jest.fn(),
|
|
110
|
+
getNext: jest.fn(),
|
|
111
|
+
} as any);
|
|
103
112
|
filter.catch(exception, mockArgumentsHost as ArgumentsHost);
|
|
104
113
|
expect(loggerServiceMock.error).toHaveBeenCalledWith(
|
|
105
114
|
exception.message,
|
|
106
115
|
exception.stack,
|
|
107
116
|
expect.anything(),
|
|
108
117
|
);
|
|
118
|
+
expect(mockResponse.status).toHaveBeenCalledWith(500);
|
|
119
|
+
expect(mockResponse.send).toHaveBeenCalledWith(exception.message);
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
it('should catch and log Non-Http error with host type http and send response', () => {
|
|
123
|
+
const exception = new Error('test');
|
|
124
|
+
mockArgumentsHost.getType.mockReturnValue('http');
|
|
125
|
+
const mockResponse = {
|
|
126
|
+
status: jest.fn().mockReturnThis(),
|
|
127
|
+
send: jest.fn(),
|
|
128
|
+
};
|
|
129
|
+
mockArgumentsHost.switchToHttp.mockReturnValue({
|
|
130
|
+
getResponse: () => mockResponse,
|
|
131
|
+
getRequest: jest.fn(),
|
|
132
|
+
getNext: jest.fn(),
|
|
133
|
+
} as any);
|
|
134
|
+
filter.catch(exception, mockArgumentsHost as ArgumentsHost);
|
|
135
|
+
expect(mockResponse.status).toHaveBeenCalledWith(500);
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
it('should not send response if sendResponse is false', () => {
|
|
139
|
+
const exception = new InternalServerErrorException();
|
|
140
|
+
mockArgumentsHost.getType.mockReturnValue('http');
|
|
141
|
+
const mockResponse = {
|
|
142
|
+
status: jest.fn().mockReturnThis(),
|
|
143
|
+
send: jest.fn(),
|
|
144
|
+
};
|
|
145
|
+
mockArgumentsHost.switchToHttp.mockReturnValue({
|
|
146
|
+
getResponse: () => mockResponse,
|
|
147
|
+
getRequest: jest.fn(),
|
|
148
|
+
getNext: jest.fn(),
|
|
149
|
+
} as any);
|
|
150
|
+
filter.catch(exception, mockArgumentsHost as ArgumentsHost, { sendResponse: false });
|
|
151
|
+
expect(mockResponse.status).not.toHaveBeenCalled();
|
|
109
152
|
});
|
|
110
153
|
|
|
111
154
|
it('should catch and log Http log with host type http', () => {
|
|
112
155
|
const exception = new BadRequestException();
|
|
113
156
|
mockArgumentsHost.getType.mockReturnValue('http');
|
|
157
|
+
const mockResponse = {
|
|
158
|
+
status: jest.fn().mockReturnThis(),
|
|
159
|
+
send: jest.fn(),
|
|
160
|
+
};
|
|
161
|
+
mockArgumentsHost.switchToHttp.mockReturnValue({
|
|
162
|
+
getResponse: () => mockResponse,
|
|
163
|
+
getRequest: jest.fn(),
|
|
164
|
+
getNext: jest.fn(),
|
|
165
|
+
} as any);
|
|
114
166
|
filter.catch(exception, mockArgumentsHost as ArgumentsHost);
|
|
115
167
|
expect(loggerServiceMock.log).toHaveBeenCalledWith(
|
|
116
168
|
exception.message,
|
|
117
169
|
expect.anything(),
|
|
118
170
|
);
|
|
171
|
+
expect(mockResponse.status).toHaveBeenCalledWith(400);
|
|
119
172
|
});
|
|
120
173
|
|
|
121
174
|
it('should catch an error with the logger itself', () => {
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
afterEach,
|
|
10
10
|
} from '@jest/globals';
|
|
11
11
|
import { BadRequestError, InputValidationError } from '../error.class.js';
|
|
12
|
-
import { ErrorsEnum } from '
|
|
12
|
+
import { ErrorsEnum } from '@node-yalc/errors/error.enum.js';
|
|
13
13
|
|
|
14
14
|
describe('InputValidationError', () => {
|
|
15
15
|
it('should have internal message without the custom message', () => {
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
import { createMock } from '@golevelup/ts-jest';
|
|
12
12
|
import { LoggerService, UnprocessableEntityException } from '@nestjs/common';
|
|
13
13
|
|
|
14
|
-
import { ExceptionContextEnum } from '
|
|
14
|
+
import { ExceptionContextEnum } from '@node-yalc/errors/error.enum.js';
|
|
15
15
|
import { SystemExceptionFilter } from '../filters/system-exception.filter.js';
|
|
16
16
|
|
|
17
17
|
describe('System exceptions filter', () => {
|
|
@@ -2,7 +2,7 @@ import { expect, describe, it } from '@jest/globals';
|
|
|
2
2
|
import {
|
|
3
3
|
getHttpStatusDescription,
|
|
4
4
|
HttpStatusCodes,
|
|
5
|
-
} from '@
|
|
5
|
+
} from '@node-yalc/utils/http.helper.js';
|
|
6
6
|
import { HttpException } from '@nestjs/common';
|
|
7
7
|
import { AdditionalVerificationNeededError } from '../index.js';
|
|
8
8
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { GqlExceptionFilter } from '@nestjs/graphql';
|
|
2
2
|
import * as common from '@nestjs/common';
|
|
3
|
+
import type { LoggerService } from '@nestjs/common';
|
|
3
4
|
export declare class DatabaseExceptionFilter implements GqlExceptionFilter {
|
|
4
5
|
private logger;
|
|
5
|
-
constructor(logger:
|
|
6
|
+
constructor(logger: LoggerService);
|
|
6
7
|
catch(error: Error, host: common.ArgumentsHost): Error;
|
|
7
8
|
}
|
|
@@ -1,52 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
-
};
|
|
24
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
-
var ownKeys = function(o) {
|
|
26
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
-
var ar = [];
|
|
28
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
-
return ar;
|
|
30
|
-
};
|
|
31
|
-
return ownKeys(o);
|
|
32
|
-
};
|
|
33
|
-
return function (mod) {
|
|
34
|
-
if (mod && mod.__esModule) return mod;
|
|
35
|
-
var result = {};
|
|
36
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
-
__setModuleDefault(result, mod);
|
|
38
|
-
return result;
|
|
39
|
-
};
|
|
40
|
-
})();
|
|
41
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
42
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
43
|
-
};
|
|
44
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
3
|
exports.DatabaseExceptionFilter = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
46
5
|
const graphql_1 = require("@nestjs/graphql");
|
|
47
|
-
const common = __importStar(require("@nestjs/common"));
|
|
6
|
+
const common = tslib_1.__importStar(require("@nestjs/common"));
|
|
48
7
|
const typeorm_1 = require("typeorm");
|
|
49
|
-
const error_enum_js_1 = require("
|
|
8
|
+
const error_enum_js_1 = require("@node-yalc/errors/error.enum.js");
|
|
50
9
|
let DatabaseExceptionFilter = class DatabaseExceptionFilter {
|
|
51
10
|
constructor(logger) {
|
|
52
11
|
this.logger = logger;
|
|
@@ -67,8 +26,8 @@ let DatabaseExceptionFilter = class DatabaseExceptionFilter {
|
|
|
67
26
|
}
|
|
68
27
|
};
|
|
69
28
|
exports.DatabaseExceptionFilter = DatabaseExceptionFilter;
|
|
70
|
-
exports.DatabaseExceptionFilter = DatabaseExceptionFilter = __decorate([
|
|
29
|
+
exports.DatabaseExceptionFilter = DatabaseExceptionFilter = tslib_1.__decorate([
|
|
71
30
|
common.Catch(typeorm_1.EntityNotFoundError, typeorm_1.ConnectionNotFoundError),
|
|
72
|
-
__metadata("design:paramtypes", [Object])
|
|
31
|
+
tslib_1.__metadata("design:paramtypes", [Object])
|
|
73
32
|
], DatabaseExceptionFilter);
|
|
74
33
|
//# sourceMappingURL=database-exception.filter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"database-exception.filter.js","sourceRoot":"","sources":["database-exception.filter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"database-exception.filter.js","sourceRoot":"","sources":["database-exception.filter.ts"],"names":[],"mappings":";;;;AAAA,6CAAuE;AACvE,+DAAyC;AAEzC,qCAAuE;AACvE,mEAAuE;AAKhE,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAClC,YAAoB,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;IAAG,CAAC;IAE7C,KAAK,CAAC,KAAY,EAAE,IAA0B;QAC5C,MAAM,OAAO,GAAG,0BAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC9C,OAAO,CAAC,OAAO,EAAE,CAAC;QAWlB,QAAQ,IAAI,EAAE,CAAC;YAIb,KAAK,KAAK,YAAY,6BAAmB;gBACvC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,oCAAoB,CAAC,QAAQ,CAAC,CAAC;gBACxD,KAAK,GAAG,IAAI,MAAM,CAAC,4BAA4B,CAAC,KAAK,CAAC,CAAC;gBAEvD,MAAM;YAER;gBACE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,oCAAoB,CAAC,QAAQ,CAAC,CAAC;gBAErE,MAAM;QACV,CAAC;QAGD,OAAO,KAAK,CAAC;IACf,CAAC;CACF,CAAA;AAnCY,0DAAuB;kCAAvB,uBAAuB;IADnC,MAAM,CAAC,KAAK,CAAC,6BAAmB,EAAE,iCAAuB,CAAC;;GAC9C,uBAAuB,CAmCnC"}
|
|
@@ -2,11 +2,13 @@ import { GqlExceptionFilter, GqlArgumentsHost } from '@nestjs/graphql';
|
|
|
2
2
|
import * as common from '@nestjs/common';
|
|
3
3
|
// We can import more errors from the typeorm/error folder if necessary, nothing is exported though, so use explicit paths.
|
|
4
4
|
import { EntityNotFoundError, ConnectionNotFoundError } from 'typeorm';
|
|
5
|
-
import { ExceptionContextEnum } from '
|
|
5
|
+
import { ExceptionContextEnum } from '@node-yalc/errors/error.enum.js';
|
|
6
|
+
|
|
7
|
+
import type { LoggerService } from '@nestjs/common';
|
|
6
8
|
|
|
7
9
|
@common.Catch(EntityNotFoundError, ConnectionNotFoundError)
|
|
8
10
|
export class DatabaseExceptionFilter implements GqlExceptionFilter {
|
|
9
|
-
constructor(private logger:
|
|
11
|
+
constructor(private logger: LoggerService) {}
|
|
10
12
|
|
|
11
13
|
catch(error: Error, host: common.ArgumentsHost) {
|
|
12
14
|
const gqlHost = GqlArgumentsHost.create(host);
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { GqlExceptionFilter } from '@nestjs/graphql';
|
|
2
2
|
import * as common from '@nestjs/common';
|
|
3
|
+
import type { HttpServer } from '@nestjs/common';
|
|
3
4
|
import { DefaultErrorMixin, MissingArgumentsError } from '@nest-yalc-2/errors';
|
|
4
5
|
import { FastifyReply as FResponse } from 'fastify';
|
|
5
6
|
import { GqlError } from '@nest-yalc-2/graphql/plugins/gql.error.js';
|
|
6
7
|
import { BaseExceptionFilter } from '@nestjs/core';
|
|
7
|
-
import { type ImprovedLoggerService } from '@
|
|
8
|
+
import { type ImprovedLoggerService } from '@node-yalc/logger/logger-abstract.service.js';
|
|
8
9
|
type HttpErrorType = common.HttpException | MissingArgumentsError | GqlError | DefaultErrorMixin;
|
|
9
10
|
export declare class HttpExceptionFilter extends BaseExceptionFilter implements GqlExceptionFilter, common.ExceptionFilter {
|
|
10
11
|
protected logger: ImprovedLoggerService;
|
|
11
|
-
constructor(logger: ImprovedLoggerService, applicationRef?:
|
|
12
|
+
constructor(logger: ImprovedLoggerService, applicationRef?: HttpServer);
|
|
12
13
|
catch(error: Error | HttpErrorType, host: common.ArgumentsHost, { sendResponse }?: {
|
|
13
14
|
sendResponse: boolean;
|
|
14
|
-
}): Error | import("@
|
|
15
|
+
}): Error | import("@node-yalc/errors").IAbstractDefaultError | FResponse<import("fastify").RouteGenericInterface, import("fastify").RawServerDefault, import("node:http").IncomingMessage, import("node:http").ServerResponse<import("node:http").IncomingMessage>, unknown, import("fastify").FastifySchema, import("fastify").FastifyTypeProviderDefault, unknown>;
|
|
15
16
|
}
|
|
16
17
|
export {};
|
|
@@ -1,55 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
-
};
|
|
24
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
-
var ownKeys = function(o) {
|
|
26
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
-
var ar = [];
|
|
28
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
-
return ar;
|
|
30
|
-
};
|
|
31
|
-
return ownKeys(o);
|
|
32
|
-
};
|
|
33
|
-
return function (mod) {
|
|
34
|
-
if (mod && mod.__esModule) return mod;
|
|
35
|
-
var result = {};
|
|
36
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
-
__setModuleDefault(result, mod);
|
|
38
|
-
return result;
|
|
39
|
-
};
|
|
40
|
-
})();
|
|
41
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
42
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
43
|
-
};
|
|
44
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
3
|
exports.HttpExceptionFilter = void 0;
|
|
46
|
-
const
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const common = tslib_1.__importStar(require("@nestjs/common"));
|
|
47
6
|
const errors_1 = require("@nest-yalc-2/errors");
|
|
48
7
|
const entity_error_js_1 = require("@nest-yalc-2/crud-gen/entity.error.js");
|
|
49
8
|
const gql_error_js_1 = require("@nest-yalc-2/graphql/plugins/gql.error.js");
|
|
50
9
|
const core_1 = require("@nestjs/core");
|
|
51
10
|
const event_helper_js_1 = require("../../../event-manager/src/event.helper.js");
|
|
52
|
-
const logger_enum_js_1 = require("@
|
|
11
|
+
const logger_enum_js_1 = require("@node-yalc/logger/logger.enum.js");
|
|
53
12
|
let HttpExceptionFilter = class HttpExceptionFilter extends core_1.BaseExceptionFilter {
|
|
54
13
|
constructor(logger, applicationRef) {
|
|
55
14
|
super(applicationRef);
|
|
@@ -138,8 +97,8 @@ let HttpExceptionFilter = class HttpExceptionFilter extends core_1.BaseException
|
|
|
138
97
|
}
|
|
139
98
|
};
|
|
140
99
|
exports.HttpExceptionFilter = HttpExceptionFilter;
|
|
141
|
-
exports.HttpExceptionFilter = HttpExceptionFilter = __decorate([
|
|
100
|
+
exports.HttpExceptionFilter = HttpExceptionFilter = tslib_1.__decorate([
|
|
142
101
|
common.Catch(common.HttpException, errors_1.MissingArgumentsError, gql_error_js_1.GqlError, errors_1.DefaultErrorMixin),
|
|
143
|
-
__metadata("design:paramtypes", [Object, Object])
|
|
102
|
+
tslib_1.__metadata("design:paramtypes", [Object, Object])
|
|
144
103
|
], HttpExceptionFilter);
|
|
145
104
|
//# sourceMappingURL=http-exception.filter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-exception.filter.js","sourceRoot":"","sources":["http-exception.filter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"http-exception.filter.js","sourceRoot":"","sources":["http-exception.filter.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { GqlExceptionFilter } from '@nestjs/graphql';
|
|
2
2
|
import * as common from '@nestjs/common';
|
|
3
|
+
import type { HttpServer } from '@nestjs/common';
|
|
3
4
|
import {
|
|
4
5
|
DefaultErrorMixin,
|
|
5
6
|
MissingArgumentsError,
|
|
@@ -14,8 +15,8 @@ import { FastifyReply as FResponse } from 'fastify';
|
|
|
14
15
|
import { GqlError } from '@nest-yalc-2/graphql/plugins/gql.error.js';
|
|
15
16
|
import { BaseExceptionFilter } from '@nestjs/core';
|
|
16
17
|
import { getLogLevelByStatus } from '../../../event-manager/src/event.helper.js';
|
|
17
|
-
import { LogLevelEnum } from '@
|
|
18
|
-
import { type ImprovedLoggerService } from '@
|
|
18
|
+
import { LogLevelEnum } from '@node-yalc/logger/logger.enum.js';
|
|
19
|
+
import { type ImprovedLoggerService } from '@node-yalc/logger/logger-abstract.service.js';
|
|
19
20
|
|
|
20
21
|
type HttpErrorType =
|
|
21
22
|
common.HttpException | MissingArgumentsError | GqlError | DefaultErrorMixin;
|
|
@@ -31,7 +32,7 @@ export class HttpExceptionFilter
|
|
|
31
32
|
{
|
|
32
33
|
constructor(
|
|
33
34
|
protected logger: ImprovedLoggerService,
|
|
34
|
-
applicationRef?:
|
|
35
|
+
applicationRef?: HttpServer,
|
|
35
36
|
) {
|
|
36
37
|
super(applicationRef);
|
|
37
38
|
}
|
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.SystemExceptionFilter = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
13
5
|
const common_1 = require("@nestjs/common");
|
|
14
|
-
const error_enum_js_1 = require("
|
|
6
|
+
const error_enum_js_1 = require("@node-yalc/errors/error.enum.js");
|
|
15
7
|
let SystemExceptionFilter = class SystemExceptionFilter {
|
|
16
8
|
constructor(logger) {
|
|
17
9
|
this.logger = logger;
|
|
@@ -22,8 +14,8 @@ let SystemExceptionFilter = class SystemExceptionFilter {
|
|
|
22
14
|
}
|
|
23
15
|
};
|
|
24
16
|
exports.SystemExceptionFilter = SystemExceptionFilter;
|
|
25
|
-
exports.SystemExceptionFilter = SystemExceptionFilter = __decorate([
|
|
17
|
+
exports.SystemExceptionFilter = SystemExceptionFilter = tslib_1.__decorate([
|
|
26
18
|
(0, common_1.Catch)(TypeError, SyntaxError, RangeError, EvalError, ReferenceError),
|
|
27
|
-
__metadata("design:paramtypes", [Object])
|
|
19
|
+
tslib_1.__metadata("design:paramtypes", [Object])
|
|
28
20
|
], SystemExceptionFilter);
|
|
29
21
|
//# sourceMappingURL=system-exception.filter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system-exception.filter.js","sourceRoot":"","sources":["system-exception.filter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"system-exception.filter.js","sourceRoot":"","sources":["system-exception.filter.ts"],"names":[],"mappings":";;;;AAAA,2CAAwD;AAExD,mEAAuE;AAGhE,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAChC,YAAoB,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;IAAG,CAAC;IAE7C,KAAK,CAAC,KAAY;QAChB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,oCAAoB,CAAC,MAAM,CAAC,CAAC;QACnE,OAAO,KAAK,CAAC;IACf,CAAC;CACF,CAAA;AAPY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,cAAK,EAAC,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,cAAc,CAAC;;GACxD,qBAAqB,CAOjC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Catch, ExceptionFilter } from '@nestjs/common';
|
|
2
2
|
import type { LoggerService } from '@nestjs/common';
|
|
3
|
-
import { ExceptionContextEnum } from '
|
|
3
|
+
import { ExceptionContextEnum } from '@node-yalc/errors/error.enum.js';
|
|
4
4
|
|
|
5
5
|
@Catch(TypeError, SyntaxError, RangeError, EvalError, ReferenceError)
|
|
6
6
|
export class SystemExceptionFilter implements ExceptionFilter {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as common from '@nestjs/common';
|
|
2
1
|
import { GqlExceptionFilter } from '@nestjs/graphql';
|
|
3
2
|
import { InputValidationError } from '../index.js';
|
|
3
|
+
import type { LoggerService } from '@nestjs/common';
|
|
4
4
|
export declare class ValidationExceptionFilter implements GqlExceptionFilter {
|
|
5
5
|
private logger;
|
|
6
|
-
constructor(logger:
|
|
6
|
+
constructor(logger: LoggerService);
|
|
7
7
|
catch(error: Error): InputValidationError;
|
|
8
8
|
}
|
|
@@ -1,51 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
-
};
|
|
24
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
-
var ownKeys = function(o) {
|
|
26
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
-
var ar = [];
|
|
28
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
-
return ar;
|
|
30
|
-
};
|
|
31
|
-
return ownKeys(o);
|
|
32
|
-
};
|
|
33
|
-
return function (mod) {
|
|
34
|
-
if (mod && mod.__esModule) return mod;
|
|
35
|
-
var result = {};
|
|
36
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
-
__setModuleDefault(result, mod);
|
|
38
|
-
return result;
|
|
39
|
-
};
|
|
40
|
-
})();
|
|
41
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
42
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
43
|
-
};
|
|
44
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
3
|
exports.ValidationExceptionFilter = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
46
5
|
const crud_gen_error_js_1 = require("@nest-yalc-2/crud-gen/crud-gen.error.js");
|
|
47
6
|
const uuid_validation_error_js_1 = require("@nest-yalc-2/graphql/scalars/uuid-validation.error.js");
|
|
48
|
-
const common = __importStar(require("@nestjs/common"));
|
|
7
|
+
const common = tslib_1.__importStar(require("@nestjs/common"));
|
|
49
8
|
const index_js_1 = require("../index.js");
|
|
50
9
|
let ValidationExceptionFilter = class ValidationExceptionFilter {
|
|
51
10
|
constructor(logger) {
|
|
@@ -59,8 +18,8 @@ let ValidationExceptionFilter = class ValidationExceptionFilter {
|
|
|
59
18
|
}
|
|
60
19
|
};
|
|
61
20
|
exports.ValidationExceptionFilter = ValidationExceptionFilter;
|
|
62
|
-
exports.ValidationExceptionFilter = ValidationExceptionFilter = __decorate([
|
|
21
|
+
exports.ValidationExceptionFilter = ValidationExceptionFilter = tslib_1.__decorate([
|
|
63
22
|
common.Catch(uuid_validation_error_js_1.UUIDValidationError, crud_gen_error_js_1.CrudGenError),
|
|
64
|
-
__metadata("design:paramtypes", [Object])
|
|
23
|
+
tslib_1.__metadata("design:paramtypes", [Object])
|
|
65
24
|
], ValidationExceptionFilter);
|
|
66
25
|
//# sourceMappingURL=validation-exception.filter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation-exception.filter.js","sourceRoot":"","sources":["validation-exception.filter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validation-exception.filter.js","sourceRoot":"","sources":["validation-exception.filter.ts"],"names":[],"mappings":";;;;AAAA,+EAAuE;AACvE,oGAA4F;AAC5F,+DAAyC;AAEzC,0CAAmD;AAK5C,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IACpC,YAAoB,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;IAAG,CAAC;IAE7C,KAAK,CAAC,KAAY;QAChB,MAAM,QAAQ,GAAG,IAAI,+BAAoB,CACxB,KAAM,CAAC,aAAa,EACnC,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,CACzC,CAAC;QACF,QAAQ,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QAC7B,IAAI,CAAC,MAAM,CAAC,KAAK,CACA,KAAM,CAAC,aAAa,IAAI,QAAQ,CAAC,OAAO,EACvD,QAAQ,CAAC,KAAK,CACf,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF,CAAA;AAhBY,8DAAyB;oCAAzB,yBAAyB;IADrC,MAAM,CAAC,KAAK,CAAC,8CAAmB,EAAE,gCAAY,CAAC;;GACnC,yBAAyB,CAgBrC"}
|
|
@@ -4,9 +4,11 @@ import * as common from '@nestjs/common';
|
|
|
4
4
|
import { GqlExceptionFilter } from '@nestjs/graphql';
|
|
5
5
|
import { InputValidationError } from '../index.js';
|
|
6
6
|
|
|
7
|
+
import type { LoggerService } from '@nestjs/common';
|
|
8
|
+
|
|
7
9
|
@common.Catch(UUIDValidationError, CrudGenError)
|
|
8
10
|
export class ValidationExceptionFilter implements GqlExceptionFilter {
|
|
9
|
-
constructor(private logger:
|
|
11
|
+
constructor(private logger: LoggerService) {}
|
|
10
12
|
|
|
11
13
|
catch(error: Error) {
|
|
12
14
|
const newError = new InputValidationError(
|
package/src/index.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
export { MissingArgumentsError } from '@nest-yalc-2/crud-gen';
|
|
2
|
-
export * from '
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './default.error.js';
|
|
5
|
-
export * from './result.error.js';
|
|
2
|
+
export * from '@node-yalc/errors';
|
|
3
|
+
export * from './filters/index.js';
|
package/src/index.js
CHANGED
|
@@ -1,24 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
3
|
exports.MissingArgumentsError = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
18
5
|
var crud_gen_1 = require("@nest-yalc-2/crud-gen");
|
|
19
6
|
Object.defineProperty(exports, "MissingArgumentsError", { enumerable: true, get: function () { return crud_gen_1.MissingArgumentsError; } });
|
|
20
|
-
__exportStar(require("
|
|
21
|
-
__exportStar(require("./
|
|
22
|
-
__exportStar(require("./default.error.js"), exports);
|
|
23
|
-
__exportStar(require("./result.error.js"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("@node-yalc/errors"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./filters/index.js"), exports);
|
|
24
9
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAEA,kDAA8D;AAArD,iHAAA,qBAAqB,OAAA;AAC9B,4DAAkC;AAClC,6DAAmC"}
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/* istanbul ignore file */
|
|
2
2
|
|
|
3
3
|
export { MissingArgumentsError } from '@nest-yalc-2/crud-gen';
|
|
4
|
-
export * from '
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './default.error.js';
|
|
7
|
-
export * from './result.error.js';
|
|
4
|
+
export * from '@node-yalc/errors';
|
|
5
|
+
export * from './filters/index.js';
|