@munlib/common 1.0.159 → 1.0.161
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,11 +1,12 @@
|
|
|
1
1
|
import { CustomError } from './custom-error';
|
|
2
2
|
export declare class GenericError extends CustomError {
|
|
3
3
|
msg: string;
|
|
4
|
+
httpStatus: number;
|
|
4
5
|
code: string;
|
|
5
6
|
typeError: string;
|
|
6
7
|
userMsg: string;
|
|
7
8
|
statusCode: number;
|
|
8
|
-
constructor(msg: string, // Mensaje principal del error
|
|
9
|
+
constructor(msg: string, httpStatus: number, // Mensaje principal del error
|
|
9
10
|
code?: string, // Código de estado (por defecto 500)
|
|
10
11
|
typeError?: string, // Tipo de error opcional
|
|
11
12
|
userMsg?: string);
|
|
@@ -20,20 +20,21 @@ var custom_error_1 = require("./custom-error"); // Asegúrate de importar tu cla
|
|
|
20
20
|
var erroresStatus_1 = require("./erroresStatus");
|
|
21
21
|
var GenericError = /** @class */ (function (_super) {
|
|
22
22
|
__extends(GenericError, _super);
|
|
23
|
-
function GenericError(msg, // Mensaje principal del error
|
|
23
|
+
function GenericError(msg, httpStatus, // Mensaje principal del error
|
|
24
24
|
code, // Código de estado (por defecto 500)
|
|
25
25
|
typeError, // Tipo de error opcional
|
|
26
26
|
userMsg // Mensaje amigable para el usuario
|
|
27
27
|
) {
|
|
28
28
|
if (code === void 0) { code = "500"; }
|
|
29
|
-
if (typeError === void 0) { typeError = "
|
|
29
|
+
if (typeError === void 0) { typeError = "MIDDLEWARE"; }
|
|
30
30
|
if (userMsg === void 0) { userMsg = "Hemos encontrado un problema. Inténtelo nuevamente más tarde."; }
|
|
31
31
|
var _this = _super.call(this, msg, typeError, userMsg) || this;
|
|
32
32
|
_this.msg = msg;
|
|
33
|
+
_this.httpStatus = httpStatus;
|
|
33
34
|
_this.code = code;
|
|
34
35
|
_this.typeError = typeError;
|
|
35
36
|
_this.userMsg = userMsg;
|
|
36
|
-
_this.statusCode =
|
|
37
|
+
_this.statusCode = _this.httpStatus;
|
|
37
38
|
_this.msg = erroresStatus_1.ErrorController.getErrorMessage(code) || _this.message;
|
|
38
39
|
Object.setPrototypeOf(_this, GenericError.prototype);
|
|
39
40
|
return _this;
|