@munlib/common 1.0.113 → 1.0.115
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 +4 -3
- package/build/errors/bad-request-error.js +4 -4
- package/build/errors/custom-error.d.ts +2 -2
- package/build/errors/custom-error.js +2 -2
- package/build/errors/database-connection-error.d.ts +1 -1
- package/build/errors/database-connection-error.js +1 -1
- package/build/errors/not-authorized-error.d.ts +1 -1
- package/build/errors/not-authorized-error.js +1 -1
- package/build/errors/not-found-error.d.ts +1 -1
- package/build/errors/not-found-error.js +1 -1
- package/build/errors/request-validation-error.d.ts +1 -1
- package/build/errors/request-validation-error.js +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { CustomError } from './custom-error';
|
|
2
2
|
export declare class BadRequestError extends CustomError {
|
|
3
|
-
|
|
3
|
+
msg: string;
|
|
4
4
|
statusCode: number;
|
|
5
|
-
constructor(
|
|
5
|
+
constructor(msg: string, statusCode?: number);
|
|
6
6
|
serializeErrors(): {
|
|
7
|
-
|
|
7
|
+
msg: string;
|
|
8
|
+
status: number;
|
|
8
9
|
}[];
|
|
9
10
|
}
|
|
@@ -19,16 +19,16 @@ exports.BadRequestError = void 0;
|
|
|
19
19
|
var custom_error_1 = require("./custom-error");
|
|
20
20
|
var BadRequestError = /** @class */ (function (_super) {
|
|
21
21
|
__extends(BadRequestError, _super);
|
|
22
|
-
function BadRequestError(
|
|
23
|
-
var _this = _super.call(this,
|
|
24
|
-
_this.
|
|
22
|
+
function BadRequestError(msg, statusCode) {
|
|
23
|
+
var _this = _super.call(this, msg) || this;
|
|
24
|
+
_this.msg = msg;
|
|
25
25
|
_this.statusCode = 400;
|
|
26
26
|
_this.statusCode = statusCode ? _this.statusCode : 400;
|
|
27
27
|
Object.setPrototypeOf(_this, BadRequestError.prototype);
|
|
28
28
|
return _this;
|
|
29
29
|
}
|
|
30
30
|
BadRequestError.prototype.serializeErrors = function () {
|
|
31
|
-
return [{
|
|
31
|
+
return [{ msg: this.message, status: this.statusCode }];
|
|
32
32
|
};
|
|
33
33
|
return BadRequestError;
|
|
34
34
|
}(custom_error_1.CustomError));
|
|
@@ -18,8 +18,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
18
18
|
exports.CustomError = void 0;
|
|
19
19
|
var CustomError = /** @class */ (function (_super) {
|
|
20
20
|
__extends(CustomError, _super);
|
|
21
|
-
function CustomError(
|
|
22
|
-
var _this = _super.call(this,
|
|
21
|
+
function CustomError(msg) {
|
|
22
|
+
var _this = _super.call(this, msg) || this;
|
|
23
23
|
Object.setPrototypeOf(_this, CustomError.prototype);
|
|
24
24
|
return _this;
|
|
25
25
|
}
|
|
@@ -27,7 +27,7 @@ var DatabaseConnectionError = /** @class */ (function (_super) {
|
|
|
27
27
|
return _this;
|
|
28
28
|
}
|
|
29
29
|
DatabaseConnectionError.prototype.serializeErrors = function () {
|
|
30
|
-
return [{
|
|
30
|
+
return [{ msg: this.reason }];
|
|
31
31
|
};
|
|
32
32
|
return DatabaseConnectionError;
|
|
33
33
|
}(custom_error_1.CustomError));
|
|
@@ -26,7 +26,7 @@ var NotAuthorizedError = /** @class */ (function (_super) {
|
|
|
26
26
|
return _this;
|
|
27
27
|
}
|
|
28
28
|
NotAuthorizedError.prototype.serializeErrors = function () {
|
|
29
|
-
return [{
|
|
29
|
+
return [{ msg: 'Token Not authorized' }];
|
|
30
30
|
};
|
|
31
31
|
return NotAuthorizedError;
|
|
32
32
|
}(custom_error_1.CustomError));
|
|
@@ -26,7 +26,7 @@ var NotFoundError = /** @class */ (function (_super) {
|
|
|
26
26
|
return _this;
|
|
27
27
|
}
|
|
28
28
|
NotFoundError.prototype.serializeErrors = function () {
|
|
29
|
-
return [{
|
|
29
|
+
return [{ msg: 'Not Found' }];
|
|
30
30
|
};
|
|
31
31
|
return NotFoundError;
|
|
32
32
|
}(custom_error_1.CustomError));
|
|
@@ -29,7 +29,7 @@ var RequestValidationError = /** @class */ (function (_super) {
|
|
|
29
29
|
}
|
|
30
30
|
RequestValidationError.prototype.serializeErrors = function () {
|
|
31
31
|
return this.errors.map(function (err) {
|
|
32
|
-
return {
|
|
32
|
+
return { msg: err.msg, field: err.param };
|
|
33
33
|
});
|
|
34
34
|
};
|
|
35
35
|
return RequestValidationError;
|