@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.
@@ -6,5 +6,6 @@ export declare class BadRequestError extends CustomError {
6
6
  serializeErrors(): {
7
7
  status: string;
8
8
  msg: string;
9
+ code: string;
9
10
  };
10
11
  }
@@ -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));
@@ -5,5 +5,6 @@ export declare abstract class CustomError extends Error {
5
5
  msg: string;
6
6
  field?: string;
7
7
  status: string;
8
+ code: string;
8
9
  };
9
10
  }
@@ -6,5 +6,6 @@ export declare class DatabaseConnectionError extends CustomError {
6
6
  serializeErrors(): {
7
7
  msg: string;
8
8
  status: string;
9
+ code: string;
9
10
  };
10
11
  }
@@ -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));
@@ -5,5 +5,6 @@ export declare class NotAuthorizedError extends CustomError {
5
5
  serializeErrors(): {
6
6
  status: string;
7
7
  msg: string;
8
+ code: string;
8
9
  };
9
10
  }
@@ -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));
@@ -5,5 +5,6 @@ export declare class NotFoundError extends CustomError {
5
5
  serializeErrors(): {
6
6
  status: string;
7
7
  msg: string;
8
+ code: string;
8
9
  };
9
10
  }
@@ -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));
@@ -8,5 +8,6 @@ export declare class RequestValidationError extends CustomError {
8
8
  status: string;
9
9
  msg: any;
10
10
  field: string;
11
+ code: string;
11
12
  };
12
13
  }
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@munlib/common",
3
- "version": "1.0.132",
3
+ "version": "1.0.134",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",