@munlib/common 1.0.132 → 1.0.134
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/build/errors/bad-request-error.d.ts +1 -0
- package/build/errors/bad-request-error.js +1 -1
- package/build/errors/custom-error.d.ts +1 -0
- package/build/errors/database-connection-error.d.ts +1 -0
- package/build/errors/database-connection-error.js +1 -1
- package/build/errors/not-authorized-error.d.ts +1 -0
- package/build/errors/not-authorized-error.js +1 -1
- package/build/errors/not-found-error.d.ts +1 -0
- package/build/errors/not-found-error.js +1 -1
- package/build/errors/request-validation-error.d.ts +1 -0
- package/build/errors/request-validation-error.js +1 -1
- package/build/middlewares/error-handler.js +1 -0
- package/package.json +1 -1
|
@@ -29,7 +29,7 @@ var BadRequestError = /** @class */ (function (_super) {
|
|
|
29
29
|
return _this;
|
|
30
30
|
}
|
|
31
31
|
BadRequestError.prototype.serializeErrors = function () {
|
|
32
|
-
return { status: erroresStatus_1.ErrorController.getGeneralStatus(this.statusCode.toString()), msg: this.message };
|
|
32
|
+
return { status: erroresStatus_1.ErrorController.getGeneralStatus(this.statusCode.toString()), msg: this.message, code: this.statusCode.toString() };
|
|
33
33
|
};
|
|
34
34
|
return BadRequestError;
|
|
35
35
|
}(custom_error_1.CustomError));
|
|
@@ -28,7 +28,7 @@ var DatabaseConnectionError = /** @class */ (function (_super) {
|
|
|
28
28
|
return _this;
|
|
29
29
|
}
|
|
30
30
|
DatabaseConnectionError.prototype.serializeErrors = function () {
|
|
31
|
-
return { msg: this.reason, status: erroresStatus_1.ErrorController.getGeneralStatus(this.statusCode.toString()) };
|
|
31
|
+
return { msg: this.reason, status: erroresStatus_1.ErrorController.getGeneralStatus(this.statusCode.toString()), code: this.statusCode.toString() };
|
|
32
32
|
};
|
|
33
33
|
return DatabaseConnectionError;
|
|
34
34
|
}(custom_error_1.CustomError));
|
|
@@ -27,7 +27,7 @@ var NotAuthorizedError = /** @class */ (function (_super) {
|
|
|
27
27
|
return _this;
|
|
28
28
|
}
|
|
29
29
|
NotAuthorizedError.prototype.serializeErrors = function () {
|
|
30
|
-
return { status: erroresStatus_1.ErrorController.getGeneralStatus(this.statusCode.toString()), msg: erroresStatus_1.ErrorController.getErrorMessage(this.statusCode.toString()) };
|
|
30
|
+
return { status: erroresStatus_1.ErrorController.getGeneralStatus(this.statusCode.toString()), msg: erroresStatus_1.ErrorController.getErrorMessage(this.statusCode.toString()), code: this.statusCode.toString() };
|
|
31
31
|
};
|
|
32
32
|
return NotAuthorizedError;
|
|
33
33
|
}(custom_error_1.CustomError));
|
|
@@ -27,7 +27,7 @@ var NotFoundError = /** @class */ (function (_super) {
|
|
|
27
27
|
return _this;
|
|
28
28
|
}
|
|
29
29
|
NotFoundError.prototype.serializeErrors = function () {
|
|
30
|
-
return { status: erroresStatus_1.ErrorController.getGeneralStatus(this.statusCode.toString()), msg: erroresStatus_1.ErrorController.getErrorMessage(this.statusCode.toString()) };
|
|
30
|
+
return { status: erroresStatus_1.ErrorController.getGeneralStatus(this.statusCode.toString()), msg: erroresStatus_1.ErrorController.getErrorMessage(this.statusCode.toString()), code: this.statusCode.toString() };
|
|
31
31
|
};
|
|
32
32
|
return NotFoundError;
|
|
33
33
|
}(custom_error_1.CustomError));
|
|
@@ -29,7 +29,7 @@ var RequestValidationError = /** @class */ (function (_super) {
|
|
|
29
29
|
return _this;
|
|
30
30
|
}
|
|
31
31
|
RequestValidationError.prototype.serializeErrors = function () {
|
|
32
|
-
return { status: erroresStatus_1.ErrorController.getGeneralStatus(this.statusCode.toString()), msg: this.errors[0].msg, field: this.errors[0].param };
|
|
32
|
+
return { status: erroresStatus_1.ErrorController.getGeneralStatus(this.statusCode.toString()), msg: this.errors[0].msg, field: this.errors[0].param, code: this.statusCode.toString() };
|
|
33
33
|
};
|
|
34
34
|
return RequestValidationError;
|
|
35
35
|
}(custom_error_1.CustomError));
|
|
@@ -13,6 +13,7 @@ var errorHandler = function (err, req, res, next) {
|
|
|
13
13
|
res.status(statusCode).send({
|
|
14
14
|
status: erroresStatus_1.ErrorController.getGeneralStatus(statusCode.toString()),
|
|
15
15
|
msg: err.message, // Agregar el código de estado al objeto de errores
|
|
16
|
+
code: statusCode
|
|
16
17
|
});
|
|
17
18
|
};
|
|
18
19
|
exports.errorHandler = errorHandler;
|