@ckb-ccc/core 0.0.14 → 0.0.15

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @ckb-ccc/core
2
2
 
3
+ ## 0.0.15
4
+
5
+ ### Patch Changes
6
+
7
+ - [`8f2560a`](https://github.com/ckb-ecofund/ccc/commit/8f2560ab0e5619654fff7c5eacda8425385f908e) Thanks [@Hanssen0](https://github.com/Hanssen0)! - fix(core): typed client errors
8
+
3
9
  ## 0.0.14
4
10
 
5
11
  ### Patch Changes
@@ -52,7 +52,7 @@ export class ClientIndexerSearchKeyTransaction {
52
52
  }
53
53
  export class ErrorClientBase extends Error {
54
54
  constructor(origin) {
55
- super(origin.message);
55
+ super(`Client request error ${origin.message}`);
56
56
  this.code = origin.code;
57
57
  this.data = origin.data;
58
58
  }
@@ -247,7 +247,7 @@ export class ClientJsonRpc extends Client {
247
247
  throw new Error(`Id mismatched, got ${res.id}, expected ${payload.id}`);
248
248
  }
249
249
  if (res.error) {
250
- throw new Error(`Client request error ${JSON.stringify(res.error)}`);
250
+ throw res.error;
251
251
  }
252
252
  return res.result;
253
253
  }
@@ -58,7 +58,7 @@ class ClientIndexerSearchKeyTransaction {
58
58
  exports.ClientIndexerSearchKeyTransaction = ClientIndexerSearchKeyTransaction;
59
59
  class ErrorClientBase extends Error {
60
60
  constructor(origin) {
61
- super(origin.message);
61
+ super(`Client request error ${origin.message}`);
62
62
  this.code = origin.code;
63
63
  this.data = origin.data;
64
64
  }
@@ -250,7 +250,7 @@ class ClientJsonRpc extends client_js_1.Client {
250
250
  throw new Error(`Id mismatched, got ${res.id}, expected ${payload.id}`);
251
251
  }
252
252
  if (res.error) {
253
- throw new Error(`Client request error ${JSON.stringify(res.error)}`);
253
+ throw res.error;
254
254
  }
255
255
  return res.result;
256
256
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckb-ccc/core",
3
- "version": "0.0.14",
3
+ "version": "0.0.15",
4
4
  "description": "Core of CCC - CKBer's Codebase",
5
5
  "author": "Hanssen0 <hanssen0@hanssen0.com>",
6
6
  "license": "MIT",
@@ -249,7 +249,7 @@ export class ErrorClientBase extends Error {
249
249
  public readonly data: string;
250
250
 
251
251
  constructor(origin: ErrorClientBaseLike) {
252
- super(origin.message);
252
+ super(`Client request error ${origin.message}`);
253
253
  this.code = origin.code;
254
254
  this.data = origin.data;
255
255
  }
@@ -421,7 +421,7 @@ export abstract class ClientJsonRpc extends Client {
421
421
  throw new Error(`Id mismatched, got ${res.id}, expected ${payload.id}`);
422
422
  }
423
423
  if (res.error) {
424
- throw new Error(`Client request error ${JSON.stringify(res.error)}`);
424
+ throw res.error;
425
425
  }
426
426
  return res.result;
427
427
  }