@munlib/common 1.0.120 → 1.0.121
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.
|
@@ -30,7 +30,6 @@ var RequestValidationError = /** @class */ (function (_super) {
|
|
|
30
30
|
}
|
|
31
31
|
RequestValidationError.prototype.serializeErrors = function () {
|
|
32
32
|
var _this = this;
|
|
33
|
-
console.log("22222222", this.errors);
|
|
34
33
|
return this.errors.map(function (err) {
|
|
35
34
|
return { status: erroresStatus_1.ErrorController.getGeneralStatus(_this.statusCode.toString()), msg: err.msg, field: err.param };
|
|
36
35
|
});
|
|
@@ -6,7 +6,7 @@ var erroresStatus_1 = require("../errors/erroresStatus");
|
|
|
6
6
|
var errorHandler = function (err, req, res, next) {
|
|
7
7
|
// Manejo de errores personalizados
|
|
8
8
|
if (err instanceof custom_error_1.CustomError) {
|
|
9
|
-
return res.status(err.statusCode).send(
|
|
9
|
+
return res.status(err.statusCode).send(err.serializeErrors());
|
|
10
10
|
}
|
|
11
11
|
// Manejo de errores genéricos
|
|
12
12
|
var statusCode = 400; // Código de estado por defecto para errores genéricos
|
|
@@ -6,7 +6,6 @@ var request_validation_error_1 = require("../errors/request-validation-error");
|
|
|
6
6
|
var validateRequest = function (req, res, next) {
|
|
7
7
|
var errors = (0, express_validator_1.validationResult)(req);
|
|
8
8
|
if (!errors.isEmpty()) {
|
|
9
|
-
console.log("111111111", errors);
|
|
10
9
|
throw new request_validation_error_1.RequestValidationError(errors.array());
|
|
11
10
|
}
|
|
12
11
|
next();
|