@riocrypto/common 1.0.781 → 1.0.783

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.
@@ -0,0 +1,11 @@
1
+ import { CustomError } from "./custom-error";
2
+ export declare class GenericInputError extends CustomError {
3
+ private customMessage?;
4
+ statusCode: number;
5
+ internalCode: number;
6
+ constructor(customMessage?: string | undefined);
7
+ serializeErrors(): {
8
+ code: number;
9
+ message: string;
10
+ }[];
11
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GenericInputError = void 0;
4
+ const custom_error_1 = require("./custom-error");
5
+ class GenericInputError extends custom_error_1.CustomError {
6
+ constructor(customMessage) {
7
+ super(customMessage || "Unknown input error");
8
+ this.customMessage = customMessage;
9
+ this.statusCode = 400;
10
+ this.internalCode = 39;
11
+ Object.setPrototypeOf(this, GenericInputError.prototype);
12
+ }
13
+ serializeErrors() {
14
+ return [
15
+ {
16
+ code: this.internalCode,
17
+ message: this.customMessage || "Unknown input error",
18
+ },
19
+ ];
20
+ }
21
+ }
22
+ exports.GenericInputError = GenericInputError;
@@ -0,0 +1,11 @@
1
+ import { CustomError } from "./custom-error";
2
+ export declare class GenericInternalError extends CustomError {
3
+ private customMessage?;
4
+ statusCode: number;
5
+ internalCode: number;
6
+ constructor(customMessage?: string | undefined);
7
+ serializeErrors(): {
8
+ code: number;
9
+ message: string;
10
+ }[];
11
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GenericInternalError = void 0;
4
+ const custom_error_1 = require("./custom-error");
5
+ class GenericInternalError extends custom_error_1.CustomError {
6
+ constructor(customMessage) {
7
+ super(customMessage || "Unknown internal error");
8
+ this.customMessage = customMessage;
9
+ this.statusCode = 500;
10
+ this.internalCode = 40;
11
+ Object.setPrototypeOf(this, GenericInternalError.prototype);
12
+ }
13
+ serializeErrors() {
14
+ return [
15
+ {
16
+ code: this.internalCode,
17
+ message: this.customMessage || "Unknown internal error",
18
+ },
19
+ ];
20
+ }
21
+ }
22
+ exports.GenericInternalError = GenericInternalError;
@@ -0,0 +1,10 @@
1
+ import { CustomError } from "./custom-error";
2
+ export declare class InvalidRefreshTokenError extends CustomError {
3
+ statusCode: number;
4
+ internalCode: number;
5
+ constructor();
6
+ serializeErrors(): {
7
+ code: number;
8
+ message: string;
9
+ }[];
10
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InvalidRefreshTokenError = void 0;
4
+ const custom_error_1 = require("./custom-error");
5
+ class InvalidRefreshTokenError extends custom_error_1.CustomError {
6
+ constructor() {
7
+ super("Invalid refresh token");
8
+ this.statusCode = 400;
9
+ this.internalCode = 37;
10
+ Object.setPrototypeOf(this, InvalidRefreshTokenError.prototype);
11
+ }
12
+ serializeErrors() {
13
+ return [
14
+ {
15
+ code: this.internalCode,
16
+ message: "Invalid refresh token",
17
+ },
18
+ ];
19
+ }
20
+ }
21
+ exports.InvalidRefreshTokenError = InvalidRefreshTokenError;
@@ -1,8 +1,9 @@
1
1
  import { CustomError } from "./custom-error";
2
2
  export declare class NotFoundError extends CustomError {
3
+ private object;
3
4
  statusCode: number;
4
5
  internalCode: number;
5
- constructor();
6
+ constructor(object: string);
6
7
  serializeErrors(): {
7
8
  code: number;
8
9
  message: string;
@@ -3,14 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NotFoundError = void 0;
4
4
  const custom_error_1 = require("./custom-error");
5
5
  class NotFoundError extends custom_error_1.CustomError {
6
- constructor() {
7
- super("Route not found");
6
+ constructor(object) {
7
+ super(`${object} not found`);
8
+ this.object = object;
8
9
  this.statusCode = 404;
9
10
  this.internalCode = 21;
10
11
  Object.setPrototypeOf(this, NotFoundError.prototype);
11
12
  }
12
13
  serializeErrors() {
13
- return [{ code: this.internalCode, message: "Not found" }];
14
+ return [{ code: this.internalCode, message: `${this.object} not found` }];
14
15
  }
15
16
  }
16
17
  exports.NotFoundError = NotFoundError;
@@ -0,0 +1,10 @@
1
+ import { CustomError } from "./custom-error";
2
+ export declare class SecretManagerError extends CustomError {
3
+ statusCode: number;
4
+ internalCode: number;
5
+ constructor();
6
+ serializeErrors(): {
7
+ code: number;
8
+ message: string;
9
+ }[];
10
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SecretManagerError = void 0;
4
+ const custom_error_1 = require("./custom-error");
5
+ class SecretManagerError extends custom_error_1.CustomError {
6
+ constructor() {
7
+ super("Internal error");
8
+ this.statusCode = 500;
9
+ this.internalCode = 38;
10
+ Object.setPrototypeOf(this, SecretManagerError.prototype);
11
+ }
12
+ serializeErrors() {
13
+ return [
14
+ {
15
+ code: this.internalCode,
16
+ message: "Internal errror",
17
+ },
18
+ ];
19
+ }
20
+ }
21
+ exports.SecretManagerError = SecretManagerError;
package/build/index.d.ts CHANGED
@@ -35,6 +35,10 @@ export * from "./errors/partner-auth-not-found-error";
35
35
  export * from "./errors/missing-cpf-error";
36
36
  export * from "./errors/active-sell-order-error";
37
37
  export * from "./errors/unavailable-in-sandbox-error";
38
+ export * from "./errors/generic-input-error";
39
+ export * from "./errors/generic-internal-error";
40
+ export * from "./errors/invalid-refresh-token-error";
41
+ export * from "./errors/secret-manager-error";
38
42
  export * from "./events/base-listener";
39
43
  export * from "./events/base-publisher";
40
44
  export * from "./events/subjects";
package/build/index.js CHANGED
@@ -51,6 +51,10 @@ __exportStar(require("./errors/partner-auth-not-found-error"), exports);
51
51
  __exportStar(require("./errors/missing-cpf-error"), exports);
52
52
  __exportStar(require("./errors/active-sell-order-error"), exports);
53
53
  __exportStar(require("./errors/unavailable-in-sandbox-error"), exports);
54
+ __exportStar(require("./errors/generic-input-error"), exports);
55
+ __exportStar(require("./errors/generic-internal-error"), exports);
56
+ __exportStar(require("./errors/invalid-refresh-token-error"), exports);
57
+ __exportStar(require("./errors/secret-manager-error"), exports);
54
58
  __exportStar(require("./events/base-listener"), exports);
55
59
  __exportStar(require("./events/base-publisher"), exports);
56
60
  __exportStar(require("./events/subjects"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common",
3
- "version": "1.0.781",
3
+ "version": "1.0.783",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",