@cubist-labs/cubesigner-sdk 0.2.17 → 0.2.21

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/src/util.ts CHANGED
@@ -20,51 +20,6 @@ export function configDir(): string {
20
20
  return path.join(configDir, "cubesigner");
21
21
  }
22
22
 
23
- type ResponseType<D, T> = { data?: D; error?: T; response?: Response };
24
-
25
- /**
26
- * Error response type, thrown on non-successful responses.
27
- */
28
- export class ErrResponse extends Error {
29
- /** Description */
30
- readonly description?: string;
31
- /** HTTP status code text (derived from `this.status`) */
32
- readonly statusText?: string;
33
- /** HTTP status code */
34
- readonly status?: number;
35
-
36
- /**
37
- * Constructor
38
- * @param {Partial<ErrResponse>} init Initializer
39
- */
40
- constructor(init: Partial<ErrResponse>) {
41
- super(init.message);
42
- Object.assign(this, init);
43
- }
44
- }
45
-
46
- /**
47
- * Throw if on error response. Otherwise, return the response data.
48
- * @param {ResponseType} resp The response to check
49
- * @param {string} description Description to include in the thrown error
50
- * @return {D} The response data.
51
- * @internal
52
- */
53
- export function assertOk<D, T>(resp: ResponseType<D, T>, description?: string): D {
54
- if (resp.error) {
55
- throw new ErrResponse({
56
- description,
57
- message: (resp.error as any).message, // eslint-disable-line @typescript-eslint/no-explicit-any
58
- statusText: resp.response?.statusText,
59
- status: resp.response?.status,
60
- });
61
- }
62
- if (resp.data === undefined) {
63
- throw new Error("Response data is undefined");
64
- }
65
- return resp.data;
66
- }
67
-
68
23
  /**
69
24
  * Browser-friendly helper for decoding a 'base64'-encoded string into a byte array.
70
25
  *