@vizamodo/viza-dispatcher 1.3.74 â 1.3.78
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/dist/core/dispatcher.js +26 -3
- package/package.json +1 -1
package/dist/core/dispatcher.js
CHANGED
|
@@ -48,9 +48,32 @@ export async function dispatcherDispatch(input, options) {
|
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
catch (err) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
// Surface gateway error details as much as possible.
|
|
52
|
+
const parts = [];
|
|
53
|
+
const msg = String(err?.message || "").trim();
|
|
54
|
+
if (msg)
|
|
55
|
+
parts.push(msg);
|
|
56
|
+
// If dispatchToGateway attaches structured info, include it.
|
|
57
|
+
const status = err?.status;
|
|
58
|
+
const statusText = err?.statusText;
|
|
59
|
+
const bodyText = err?.bodyText;
|
|
60
|
+
if (typeof status === "number") {
|
|
61
|
+
parts.push(`HTTP ${status}${statusText ? ` ${statusText}` : ""}`);
|
|
62
|
+
}
|
|
63
|
+
if (typeof bodyText === "string" && bodyText.trim()) {
|
|
64
|
+
parts.push(`Body: ${bodyText.trim()}`);
|
|
65
|
+
}
|
|
66
|
+
const detail = parts.length ? `: ${parts.join(" | ")}` : "";
|
|
67
|
+
const hintText = parts.join(" | ");
|
|
68
|
+
const needsBootstrap = hintText.includes("encrypted_payload_invalid_or_decrypt_failed") ||
|
|
69
|
+
hintText.includes("decrypt_failed") ||
|
|
70
|
+
hintText.includes("run_viza_bootstrap");
|
|
71
|
+
if (needsBootstrap) {
|
|
72
|
+
throw new DispatchRejectedError("đ Gateway rejected encrypted payload (key mismatch / rotated key)\n\n" +
|
|
73
|
+
"â
Fix: Run `viza bootstrap` to refresh gateway config\n" +
|
|
74
|
+
"âšī¸ Then retry the command.", { cause: err });
|
|
75
|
+
}
|
|
76
|
+
throw new DispatchRejectedError(`Dispatch request rejected by gateway${detail}`, { cause: err });
|
|
54
77
|
}
|
|
55
78
|
return {
|
|
56
79
|
sessionId: accepted.sessionId,
|