eservices-back-core 2.0.4 → 2.0.6
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 { Request, Response } from "express";
|
|
2
|
-
declare const _default: (err: any, req: Request, res: Response, next: any) => Promise<
|
|
2
|
+
declare const _default: (err: any, req: Request, res: Response, next: any) => Promise<any>;
|
|
3
3
|
export default _default;
|
|
4
4
|
//# sourceMappingURL=error-middleware.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-middleware.d.ts","sourceRoot":"","sources":["../../src/middleware/error-middleware.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,SAAS,CAAC;wCAWV,OAAO,OAAO,QAAQ;AAAtD,
|
|
1
|
+
{"version":3,"file":"error-middleware.d.ts","sourceRoot":"","sources":["../../src/middleware/error-middleware.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,SAAS,CAAC;wCAWV,OAAO,OAAO,QAAQ;AAAtD,wBAwBE"}
|
|
@@ -16,7 +16,6 @@ const api_error_1 = __importDefault(require("../errors/api-error"));
|
|
|
16
16
|
const error_response_dto_1 = __importDefault(require("../dtos/error-response-dto"));
|
|
17
17
|
const auth_middleware_1 = require("./auth-middleware");
|
|
18
18
|
const use_logger_1 = require("../logger/use-logger");
|
|
19
|
-
const auth_error_1 = __importDefault(require("../errors/auth-error"));
|
|
20
19
|
const debug_1 = __importDefault(require("debug"));
|
|
21
20
|
const utils_1 = require("../utils");
|
|
22
21
|
const constants_1 = require("../constants");
|
|
@@ -25,11 +24,6 @@ exports.default = (err, req, res, next) => __awaiter(void 0, void 0, void 0, fun
|
|
|
25
24
|
try {
|
|
26
25
|
debug(err);
|
|
27
26
|
use_logger_1.Logger.error('Error level %o', err);
|
|
28
|
-
// Error bind with Authorization
|
|
29
|
-
if (err instanceof auth_error_1.default || (req.method === "GET" && !req.infoUserId)) {
|
|
30
|
-
debug('Auth error');
|
|
31
|
-
return res.redirect((0, auth_middleware_1.authModule)().endSessionURL());
|
|
32
|
-
}
|
|
33
27
|
if (typeof err === "string")
|
|
34
28
|
return void res.status(400).json((0, error_response_dto_1.default)(err, 400));
|
|
35
29
|
if (err instanceof api_error_1.default)
|
|
@@ -41,7 +35,8 @@ exports.default = (err, req, res, next) => __awaiter(void 0, void 0, void 0, fun
|
|
|
41
35
|
res.writeHead(302, { location: (0, auth_middleware_1.authModule)().authorizationUrl() });
|
|
42
36
|
}
|
|
43
37
|
catch (e) {
|
|
44
|
-
res.
|
|
38
|
+
res.status(500);
|
|
39
|
+
res.send(constants_1.DEFAULT_ERROR_MESSAGE);
|
|
45
40
|
}
|
|
46
41
|
});
|
|
47
42
|
//# sourceMappingURL=error-middleware.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-middleware.js","sourceRoot":"","sources":["../../src/middleware/error-middleware.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,oEAA2C;AAE3C,oFAA0D;AAC1D,uDAA6C;AAC7C,qDAA4C;
|
|
1
|
+
{"version":3,"file":"error-middleware.js","sourceRoot":"","sources":["../../src/middleware/error-middleware.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,oEAA2C;AAE3C,oFAA0D;AAC1D,uDAA6C;AAC7C,qDAA4C;AAE5C,kDAA+B;AAC/B,oCAA0C;AAC1C,4CAAmD;AAEnD,MAAM,KAAK,GAAG,IAAA,eAAW,EAAC,IAAA,wBAAgB,EAAC,eAAe,CAAC,CAAC,CAAC;AAE7D,kBAAe,CAAO,GAAG,EAAE,GAAY,EAAE,GAAa,EAAE,IAAI,EAAE,EAAE;IAC/D,IAAI,CAAC;QACJ,KAAK,CAAC,GAAG,CAAC,CAAC;QAEX,mBAAM,CAAC,KAAK,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAC;QAIpC,IAAI,O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