@ayoxx/kundex 2.0.6 → 2.0.7
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/package.json +1 -1
- package/src/index.ts +9 -2
- package/src/repl.ts +3 -0
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { runLogin } from "./login";
|
|
|
3
3
|
import { runRepl } from "./repl";
|
|
4
4
|
import { Kundex } from "./sdk";
|
|
5
5
|
|
|
6
|
-
const VERSION = "2.0.
|
|
6
|
+
const VERSION = "2.0.7";
|
|
7
7
|
|
|
8
8
|
// ─── Help text ────────────────────────────────────────────────────────────────
|
|
9
9
|
|
|
@@ -335,6 +335,13 @@ async function main(): Promise<void> {
|
|
|
335
335
|
}
|
|
336
336
|
|
|
337
337
|
main().catch((e) => {
|
|
338
|
-
|
|
338
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
339
|
+
if (msg.includes("fetch failed") || msg.includes("ECONNREFUSED") || msg.includes("ENOTFOUND")) {
|
|
340
|
+
console.error(`\n${c.red} ✗ Could not connect to the API server.${c.reset}`);
|
|
341
|
+
console.error(`${c.dim} Check your internet connection and try again.${c.reset}`);
|
|
342
|
+
console.error(`${c.dim} Run "kundex login" if you haven't set up your API key.${c.reset}\n`);
|
|
343
|
+
} else {
|
|
344
|
+
console.error(`\n${c.red} ✗ ${msg}${c.reset}\n`);
|
|
345
|
+
}
|
|
339
346
|
process.exitCode = 1;
|
|
340
347
|
});
|
package/src/repl.ts
CHANGED
|
@@ -373,6 +373,9 @@ export async function runRepl(config: KundexConfig, apiKey: string, baseUrl: str
|
|
|
373
373
|
const e = err as Error;
|
|
374
374
|
if (e.name === "AbortError") {
|
|
375
375
|
// Already printed "⚡ Stopped" via sigintHandler
|
|
376
|
+
} else if (e.message.includes("fetch failed") || e.message.includes("ECONNREFUSED")) {
|
|
377
|
+
console.error(`\n${c.red} ✗ Could not connect to the API server.${c.reset}`);
|
|
378
|
+
console.error(`${c.dim} Check your internet connection and try again.${c.reset}\n`);
|
|
376
379
|
} else {
|
|
377
380
|
console.error(`\n${c.red} error: ${e.message}${c.reset}\n`);
|
|
378
381
|
}
|