@munlib/common 1.0.187 → 1.0.189
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.
|
@@ -24,25 +24,21 @@ var RequestValidationError = /** @class */ (function (_super) {
|
|
|
24
24
|
function RequestValidationError(msg, typeMsg, userMsg) {
|
|
25
25
|
if (typeMsg === void 0) { typeMsg = instituciones_pagos_1.ErrorCategories.SINTAX; }
|
|
26
26
|
if (userMsg === void 0) { userMsg = erroresStatus_1.ErrorController.getErrorMessage(instituciones_pagos_1.ErrorCategories.SINTAX); }
|
|
27
|
-
var _this = _super.call(this,
|
|
27
|
+
var _this = _super.call(this, msg, typeMsg, userMsg) || this;
|
|
28
28
|
_this.msg = msg;
|
|
29
29
|
_this.typeMsg = typeMsg;
|
|
30
30
|
_this.userMsg = userMsg;
|
|
31
31
|
_this.statusCode = 400;
|
|
32
|
-
_this.
|
|
33
|
-
_this.userMsg = _this.userMsg;
|
|
34
|
-
// Only because we are extending a built in class
|
|
35
|
-
Object.setPrototypeOf(_this, RequestValidationError.prototype);
|
|
32
|
+
Object.setPrototypeOf(_this, RequestValidationError.prototype); // Verifica que el prototipo se establezca correctamente
|
|
36
33
|
return _this;
|
|
37
34
|
}
|
|
38
35
|
RequestValidationError.prototype.serializeErrors = function () {
|
|
39
|
-
console.log("******1111********", this.msg);
|
|
40
36
|
return {
|
|
41
37
|
status: erroresStatus_1.ErrorController.getGeneralStatus(this.statusCode.toString()),
|
|
42
38
|
msg: this.msg,
|
|
43
39
|
code: this.statusCode.toString(),
|
|
44
40
|
typeMsg: this.typeMsg,
|
|
45
|
-
userMsg: this.userMsg
|
|
41
|
+
userMsg: this.userMsg,
|
|
46
42
|
};
|
|
47
43
|
};
|
|
48
44
|
return RequestValidationError;
|
|
@@ -7,6 +7,7 @@ var erroresStatus_1 = require("../errors/erroresStatus");
|
|
|
7
7
|
var instituciones_pagos_1 = require("../events/types/instituciones-pagos");
|
|
8
8
|
var validateRequest = function (req, res, next) {
|
|
9
9
|
var errors = (0, express_validator_1.validationResult)(req);
|
|
10
|
+
console.log("VALIDATE REQUEST");
|
|
10
11
|
if (!errors.isEmpty()) {
|
|
11
12
|
// Extraer el primer error y sus detalles personalizados (typeError y userMsg)
|
|
12
13
|
var msg = errors.array()[0].msg.msg; // Primer error encontrado
|