@0xobelisk/sui-client 0.5.27 → 0.5.28
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/README.md +89 -196
- package/dist/dubhe.d.ts +1 -1
- package/dist/errors/index.d.ts +7 -0
- package/dist/index.js +26 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/dubhe.ts +2 -1
- package/src/errors/index.ts +31 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export class ContractDataParsingError extends Error {
|
|
2
|
+
public readonly errorType: string;
|
|
3
|
+
public readonly functionName: string;
|
|
4
|
+
public readonly moduleAddress: string;
|
|
5
|
+
public readonly errorMessage: string;
|
|
6
|
+
|
|
7
|
+
constructor(dryResult: any) {
|
|
8
|
+
const error = dryResult?.effects?.status?.error || '';
|
|
9
|
+
const functionMatch = error
|
|
10
|
+
? error.match(/function_name: Some\("([^"]+)"\)/)
|
|
11
|
+
: null;
|
|
12
|
+
const moduleMatch = error ? error.match(/address: ([a-fA-F0-9]+)/) : null;
|
|
13
|
+
|
|
14
|
+
const functionName = functionMatch ? functionMatch[1] : 'unknown';
|
|
15
|
+
const moduleAddress = moduleMatch ? '0x' + moduleMatch[1] : 'unknown';
|
|
16
|
+
const errorMessage = dryResult.error ? dryResult.error : 'UNKNOWN_ERROR';
|
|
17
|
+
|
|
18
|
+
const message = [
|
|
19
|
+
`\n- Function: ${functionName}`,
|
|
20
|
+
`- Module Address: ${moduleAddress}`,
|
|
21
|
+
`- Error Message: ${errorMessage}`,
|
|
22
|
+
].join('\n');
|
|
23
|
+
|
|
24
|
+
super(message);
|
|
25
|
+
|
|
26
|
+
this.errorType = 'ContractDataParsingError';
|
|
27
|
+
this.functionName = functionName;
|
|
28
|
+
this.moduleAddress = moduleAddress;
|
|
29
|
+
this.errorMessage = errorMessage;
|
|
30
|
+
}
|
|
31
|
+
}
|