@vlayer/sdk 0.1.0-nightly-20241120-8c3f7ae → 0.1.0-nightly-20241121-ee5bff1

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,6 @@
1
+ export declare class VersionError extends Error {
2
+ constructor(message: string);
3
+ }
4
+ export declare function parseVCallResponseError({ message, }: {
5
+ message: string | undefined;
6
+ }): Error;
@@ -0,0 +1,14 @@
1
+ export class VersionError extends Error {
2
+ constructor(message) {
3
+ super(message);
4
+ this.name = "VersionError";
5
+ }
6
+ }
7
+ export function parseVCallResponseError({ message, }) {
8
+ if (message?.startsWith("Unsupported CallGuestID")) {
9
+ return new VersionError(`${message}
10
+ vlayer uses the daily release cycle, and SDK version must match the proving server version.
11
+ Please run "vlayer update" to update the SDK to the latest version.`);
12
+ }
13
+ return new Error(`Error response: ${message ?? "unknown error"}`);
14
+ }
@@ -1,3 +1,4 @@
1
+ import { parseVCallResponseError } from "./lib/errors.js";
1
2
  function v_callBody(call, context) {
2
3
  return {
3
4
  method: "v_call",
@@ -20,7 +21,7 @@ export async function v_call(call, context, url = "http://127.0.0.1:3000") {
20
21
  console.log("response_json", response_json);
21
22
  assertObject(response_json);
22
23
  if ("error" in response_json) {
23
- throw new Error(`Error response: ${response_json.error.message || "unknown error"}`);
24
+ throw parseVCallResponseError(response_json.error);
24
25
  }
25
26
  return response_json;
26
27
  }
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "types": "./dist/config/index.d.ts"
16
16
  }
17
17
  },
18
- "version": "0.1.0-nightly-20241120-8c3f7ae",
18
+ "version": "0.1.0-nightly-20241121-ee5bff1",
19
19
  "scripts": {
20
20
  "build": "bun tsc && bun tsc-alias",
21
21
  "test:unit": "vitest --run",