@vlayer/sdk 0.1.0-nightly-20241120-8c3f7ae → 0.1.0-nightly-20241121-ee5bff1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/api/lib/errors.d.ts +6 -0
- package/dist/api/lib/errors.js +14 -0
- package/dist/api/v_call.js +2 -1
- package/package.json +1 -1
@@ -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
|
+
}
|
package/dist/api/v_call.js
CHANGED
@@ -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
|
24
|
+
throw parseVCallResponseError(response_json.error);
|
24
25
|
}
|
25
26
|
return response_json;
|
26
27
|
}
|
package/package.json
CHANGED