@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.
@@ -1,9 +1,10 @@
1
1
  import { CustomError } from './custom-error';
2
2
  export declare class BadRequestError extends CustomError {
3
- message: string;
3
+ msg: string;
4
4
  statusCode: number;
5
- constructor(message: string, statusCode?: number);
5
+ constructor(msg: string, statusCode?: number);
6
6
  serializeErrors(): {
7
- message: string;
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(message, statusCode) {
23
- var _this = _super.call(this, message) || this;
24
- _this.message = message;
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 [{ message: this.message }];
31
+ return [{ msg: this.message, status: this.statusCode }];
32
32
  };
33
33
  return BadRequestError;
34
34
  }(custom_error_1.CustomError));
@@ -1,8 +1,8 @@
1
1
  export declare abstract class CustomError extends Error {
2
2
  abstract statusCode: number;
3
- constructor(message: string);
3
+ constructor(msg: string);
4
4
  abstract serializeErrors(): {
5
- message: string;
5
+ msg: string;
6
6
  field?: string;
7
7
  }[];
8
8
  }
@@ -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(message) {
22
- var _this = _super.call(this, message) || 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
  }
@@ -4,6 +4,6 @@ export declare class DatabaseConnectionError extends CustomError {
4
4
  reason: string;
5
5
  constructor();
6
6
  serializeErrors(): {
7
- message: string;
7
+ msg: string;
8
8
  }[];
9
9
  }
@@ -27,7 +27,7 @@ var DatabaseConnectionError = /** @class */ (function (_super) {
27
27
  return _this;
28
28
  }
29
29
  DatabaseConnectionError.prototype.serializeErrors = function () {
30
- return [{ message: this.reason }];
30
+ return [{ msg: this.reason }];
31
31
  };
32
32
  return DatabaseConnectionError;
33
33
  }(custom_error_1.CustomError));
@@ -3,6 +3,6 @@ export declare class NotAuthorizedError extends CustomError {
3
3
  statusCode: number;
4
4
  constructor();
5
5
  serializeErrors(): {
6
- message: string;
6
+ msg: string;
7
7
  }[];
8
8
  }
@@ -26,7 +26,7 @@ var NotAuthorizedError = /** @class */ (function (_super) {
26
26
  return _this;
27
27
  }
28
28
  NotAuthorizedError.prototype.serializeErrors = function () {
29
- return [{ message: 'Token Not authorized' }];
29
+ return [{ msg: 'Token Not authorized' }];
30
30
  };
31
31
  return NotAuthorizedError;
32
32
  }(custom_error_1.CustomError));
@@ -3,6 +3,6 @@ export declare class NotFoundError extends CustomError {
3
3
  statusCode: number;
4
4
  constructor();
5
5
  serializeErrors(): {
6
- message: string;
6
+ msg: string;
7
7
  }[];
8
8
  }
@@ -26,7 +26,7 @@ var NotFoundError = /** @class */ (function (_super) {
26
26
  return _this;
27
27
  }
28
28
  NotFoundError.prototype.serializeErrors = function () {
29
- return [{ message: 'Not Found' }];
29
+ return [{ msg: 'Not Found' }];
30
30
  };
31
31
  return NotFoundError;
32
32
  }(custom_error_1.CustomError));
@@ -5,7 +5,7 @@ export declare class RequestValidationError extends CustomError {
5
5
  statusCode: number;
6
6
  constructor(errors: ValidationError[]);
7
7
  serializeErrors(): {
8
- message: any;
8
+ msg: any;
9
9
  field: string;
10
10
  }[];
11
11
  }
@@ -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 { message: err.msg, field: err.param };
32
+ return { msg: err.msg, field: err.param };
33
33
  });
34
34
  };
35
35
  return RequestValidationError;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@munlib/common",
3
- "version": "1.0.113",
3
+ "version": "1.0.115",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",