grm-shared-library 1.0.22 → 1.0.23
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.
|
@@ -5,12 +5,17 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
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
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
};
|
|
8
|
+
var HttpExceptionFilter_1;
|
|
8
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
10
|
exports.HttpExceptionFilter = void 0;
|
|
10
11
|
const common_1 = require("@nestjs/common");
|
|
11
12
|
const error_codes_enum_1 = require("../enums/error-codes.enum");
|
|
12
13
|
const custom_rpc_exception_1 = require("../custom-exception/custom-rpc.exception");
|
|
13
|
-
|
|
14
|
+
const error_logger_1 = require("../error-logger/error-logger");
|
|
15
|
+
let HttpExceptionFilter = HttpExceptionFilter_1 = class HttpExceptionFilter {
|
|
16
|
+
constructor() {
|
|
17
|
+
this.logger = new common_1.Logger(HttpExceptionFilter_1.name);
|
|
18
|
+
}
|
|
14
19
|
catch(exception, host) {
|
|
15
20
|
const ctx = host.switchToHttp();
|
|
16
21
|
const response = ctx.getResponse();
|
|
@@ -24,10 +29,13 @@ let HttpExceptionFilter = class HttpExceptionFilter {
|
|
|
24
29
|
if (exception instanceof common_1.HttpException) {
|
|
25
30
|
status = exception.getStatus();
|
|
26
31
|
errorResponse = exception.getResponse();
|
|
32
|
+
(0, error_logger_1.logError)(exception);
|
|
27
33
|
}
|
|
28
34
|
else if (exception instanceof custom_rpc_exception_1.CustomRpcException) {
|
|
29
35
|
errorResponse = exception.getErrorResponse();
|
|
36
|
+
(0, error_logger_1.logError)(exception, exception.getContext());
|
|
30
37
|
}
|
|
38
|
+
this.logger.error(errorResponse);
|
|
31
39
|
response.status(status).json({
|
|
32
40
|
...errorResponse,
|
|
33
41
|
path: request.url,
|
|
@@ -36,6 +44,6 @@ let HttpExceptionFilter = class HttpExceptionFilter {
|
|
|
36
44
|
}
|
|
37
45
|
};
|
|
38
46
|
exports.HttpExceptionFilter = HttpExceptionFilter;
|
|
39
|
-
exports.HttpExceptionFilter = HttpExceptionFilter = __decorate([
|
|
47
|
+
exports.HttpExceptionFilter = HttpExceptionFilter = HttpExceptionFilter_1 = __decorate([
|
|
40
48
|
(0, common_1.Catch)()
|
|
41
49
|
], HttpExceptionFilter);
|