@injectivelabs/exceptions 1.20.13 → 1.20.14
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/dist/cjs/index.cjs +11 -18
- package/dist/cjs/index.d.cts +5 -4
- package/dist/esm/index.d.ts +5 -4
- package/dist/esm/index.js +11 -18
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -682,19 +682,22 @@ var ConcreteException = class extends Error {
|
|
|
682
682
|
error.name = this.name || "";
|
|
683
683
|
return error;
|
|
684
684
|
}
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
const error = /* @__PURE__ */ new Error(`${this.message} | ${JSON.stringify({
|
|
688
|
-
type: this.type,
|
|
685
|
+
toErrorDetails(errorClass) {
|
|
686
|
+
return {
|
|
689
687
|
code: this.code,
|
|
690
|
-
|
|
688
|
+
type: this.type,
|
|
689
|
+
errorClass,
|
|
691
690
|
message: this.message,
|
|
692
691
|
context: this.context,
|
|
693
|
-
contextCode: this.contextCode,
|
|
692
|
+
...this.contextCode !== void 0 ? { contextCode: this.contextCode } : {},
|
|
694
693
|
contextModule: this.contextModule,
|
|
695
694
|
originalMessage: this.originalMessage,
|
|
696
695
|
stack: (this.stack || "").split("\n").map((line) => line.trim())
|
|
697
|
-
}
|
|
696
|
+
};
|
|
697
|
+
}
|
|
698
|
+
toCompactError() {
|
|
699
|
+
const name = this.name || toPascalCase(this.type);
|
|
700
|
+
const error = /* @__PURE__ */ new Error(`${this.message} | ${JSON.stringify(this.toErrorDetails(name))}`);
|
|
698
701
|
error.stack = this.stack;
|
|
699
702
|
error.name = this.name || toPascalCase(this.type);
|
|
700
703
|
return error;
|
|
@@ -707,17 +710,7 @@ var ConcreteException = class extends Error {
|
|
|
707
710
|
}
|
|
708
711
|
toObject() {
|
|
709
712
|
const name = this.name || toPascalCase(this.type);
|
|
710
|
-
return
|
|
711
|
-
code: this.code,
|
|
712
|
-
type: this.type,
|
|
713
|
-
errorClass: name,
|
|
714
|
-
message: this.message,
|
|
715
|
-
context: this.context,
|
|
716
|
-
contextCode: this.contextCode,
|
|
717
|
-
contextModule: this.contextModule,
|
|
718
|
-
originalMessage: this.originalMessage,
|
|
719
|
-
stack: (this.stack || "").split("\n").map((line) => line.trim())
|
|
720
|
-
};
|
|
713
|
+
return this.toErrorDetails(name);
|
|
721
714
|
}
|
|
722
715
|
toString() {
|
|
723
716
|
return this.message;
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -671,18 +671,19 @@ declare abstract class ConcreteException extends Error implements Exception {
|
|
|
671
671
|
setContextCode(code: ErrorContextCode): void;
|
|
672
672
|
toOriginalError(): Error;
|
|
673
673
|
toError(): Error;
|
|
674
|
+
private toErrorDetails;
|
|
674
675
|
toCompactError(): Error;
|
|
675
676
|
toJson(): string;
|
|
676
677
|
toObject(): {
|
|
678
|
+
contextModule: string | undefined;
|
|
679
|
+
originalMessage: string;
|
|
680
|
+
stack: string[];
|
|
681
|
+
contextCode?: number | undefined;
|
|
677
682
|
code: ErrorCode;
|
|
678
683
|
type: ErrorType;
|
|
679
684
|
errorClass: string;
|
|
680
685
|
message: string;
|
|
681
686
|
context: string | undefined;
|
|
682
|
-
contextCode: number | undefined;
|
|
683
|
-
contextModule: string | undefined;
|
|
684
|
-
originalMessage: string;
|
|
685
|
-
stack: string[];
|
|
686
687
|
};
|
|
687
688
|
toString(): string;
|
|
688
689
|
}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -671,18 +671,19 @@ declare abstract class ConcreteException extends Error implements Exception {
|
|
|
671
671
|
setContextCode(code: ErrorContextCode): void;
|
|
672
672
|
toOriginalError(): Error;
|
|
673
673
|
toError(): Error;
|
|
674
|
+
private toErrorDetails;
|
|
674
675
|
toCompactError(): Error;
|
|
675
676
|
toJson(): string;
|
|
676
677
|
toObject(): {
|
|
678
|
+
contextModule: string | undefined;
|
|
679
|
+
originalMessage: string;
|
|
680
|
+
stack: string[];
|
|
681
|
+
contextCode?: number | undefined;
|
|
677
682
|
code: ErrorCode;
|
|
678
683
|
type: ErrorType;
|
|
679
684
|
errorClass: string;
|
|
680
685
|
message: string;
|
|
681
686
|
context: string | undefined;
|
|
682
|
-
contextCode: number | undefined;
|
|
683
|
-
contextModule: string | undefined;
|
|
684
|
-
originalMessage: string;
|
|
685
|
-
stack: string[];
|
|
686
687
|
};
|
|
687
688
|
toString(): string;
|
|
688
689
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -681,19 +681,22 @@ var ConcreteException = class extends Error {
|
|
|
681
681
|
error.name = this.name || "";
|
|
682
682
|
return error;
|
|
683
683
|
}
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
const error = /* @__PURE__ */ new Error(`${this.message} | ${JSON.stringify({
|
|
687
|
-
type: this.type,
|
|
684
|
+
toErrorDetails(errorClass) {
|
|
685
|
+
return {
|
|
688
686
|
code: this.code,
|
|
689
|
-
|
|
687
|
+
type: this.type,
|
|
688
|
+
errorClass,
|
|
690
689
|
message: this.message,
|
|
691
690
|
context: this.context,
|
|
692
|
-
contextCode: this.contextCode,
|
|
691
|
+
...this.contextCode !== void 0 ? { contextCode: this.contextCode } : {},
|
|
693
692
|
contextModule: this.contextModule,
|
|
694
693
|
originalMessage: this.originalMessage,
|
|
695
694
|
stack: (this.stack || "").split("\n").map((line) => line.trim())
|
|
696
|
-
}
|
|
695
|
+
};
|
|
696
|
+
}
|
|
697
|
+
toCompactError() {
|
|
698
|
+
const name = this.name || toPascalCase(this.type);
|
|
699
|
+
const error = /* @__PURE__ */ new Error(`${this.message} | ${JSON.stringify(this.toErrorDetails(name))}`);
|
|
697
700
|
error.stack = this.stack;
|
|
698
701
|
error.name = this.name || toPascalCase(this.type);
|
|
699
702
|
return error;
|
|
@@ -706,17 +709,7 @@ var ConcreteException = class extends Error {
|
|
|
706
709
|
}
|
|
707
710
|
toObject() {
|
|
708
711
|
const name = this.name || toPascalCase(this.type);
|
|
709
|
-
return
|
|
710
|
-
code: this.code,
|
|
711
|
-
type: this.type,
|
|
712
|
-
errorClass: name,
|
|
713
|
-
message: this.message,
|
|
714
|
-
context: this.context,
|
|
715
|
-
contextCode: this.contextCode,
|
|
716
|
-
contextModule: this.contextModule,
|
|
717
|
-
originalMessage: this.originalMessage,
|
|
718
|
-
stack: (this.stack || "").split("\n").map((line) => line.trim())
|
|
719
|
-
};
|
|
712
|
+
return this.toErrorDetails(name);
|
|
720
713
|
}
|
|
721
714
|
toString() {
|
|
722
715
|
return this.message;
|