orchestrating 0.1.16 → 0.1.17
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/bin/orch +12 -2
- package/package.json +1 -1
package/bin/orch
CHANGED
|
@@ -928,8 +928,18 @@ async function connectWs() {
|
|
|
928
928
|
if (msg.type === "error") {
|
|
929
929
|
process.stderr.write(`${RED}Server error: ${msg.error}${RESET}\n`);
|
|
930
930
|
if (/unauthorized|auth|token/i.test(msg.error || "")) {
|
|
931
|
-
|
|
932
|
-
|
|
931
|
+
// Try to refresh token before giving up
|
|
932
|
+
refreshAuthToken().then((refreshed) => {
|
|
933
|
+
if (refreshed) {
|
|
934
|
+
authToken = refreshed;
|
|
935
|
+
process.stderr.write(`${DIM}[orch] Token refreshed, reconnecting…${RESET}\n`);
|
|
936
|
+
authFailed = false;
|
|
937
|
+
connectWs();
|
|
938
|
+
} else {
|
|
939
|
+
process.stderr.write(`${RED}Run 'orch login' to authenticate.${RESET}\n`);
|
|
940
|
+
authFailed = true;
|
|
941
|
+
}
|
|
942
|
+
});
|
|
933
943
|
}
|
|
934
944
|
return;
|
|
935
945
|
}
|