agdi 1.0.2 → 1.0.3
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/index.js +27 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -622,8 +622,24 @@ async function startChat() {
|
|
|
622
622
|
}
|
|
623
623
|
} catch (error) {
|
|
624
624
|
spinner.fail("Error");
|
|
625
|
-
|
|
626
|
-
|
|
625
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
626
|
+
if (errorMessage.includes("429") || errorMessage.includes("quota") || errorMessage.includes("Resource exhausted") || errorMessage.includes("ResourceExhausted")) {
|
|
627
|
+
console.log(chalk2.yellow("\n\u26A0\uFE0F API quota exceeded!"));
|
|
628
|
+
console.log(chalk2.gray("Your API key has run out of credits."));
|
|
629
|
+
console.log(chalk2.gray("Try: Use a different API key or wait for quota reset.\n"));
|
|
630
|
+
} else if (errorMessage.includes("401") || errorMessage.includes("Unauthorized") || errorMessage.includes("Invalid API key")) {
|
|
631
|
+
console.log(chalk2.red("\n\u{1F511} Invalid API key"));
|
|
632
|
+
console.log(chalk2.gray("Please reconfigure your API key:"));
|
|
633
|
+
console.log(chalk2.cyan(" agdi auth\n"));
|
|
634
|
+
} else if (errorMessage.includes("403") || errorMessage.includes("Forbidden")) {
|
|
635
|
+
console.log(chalk2.red("\n\u{1F6AB} Access denied"));
|
|
636
|
+
console.log(chalk2.gray("Your API key doesn't have permission for this operation.\n"));
|
|
637
|
+
} else if (errorMessage.includes("network") || errorMessage.includes("fetch") || errorMessage.includes("ENOTFOUND")) {
|
|
638
|
+
console.log(chalk2.red("\n\u{1F310} Network error"));
|
|
639
|
+
console.log(chalk2.gray("Please check your internet connection.\n"));
|
|
640
|
+
} else {
|
|
641
|
+
console.log(chalk2.red("\n" + errorMessage + "\n"));
|
|
642
|
+
}
|
|
627
643
|
}
|
|
628
644
|
}
|
|
629
645
|
}
|
|
@@ -766,7 +782,15 @@ program.command("generate <prompt>").alias("g").description("Generate an app fro
|
|
|
766
782
|
spinner.succeed(`App generated in ${chalk3.cyan(options.output)}`);
|
|
767
783
|
} catch (error) {
|
|
768
784
|
spinner.fail("Generation failed");
|
|
769
|
-
|
|
785
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
786
|
+
if (errorMessage.includes("429") || errorMessage.includes("quota") || errorMessage.includes("Resource exhausted")) {
|
|
787
|
+
console.log(chalk3.yellow("\n\u26A0\uFE0F API quota exceeded!"));
|
|
788
|
+
console.log(chalk3.gray("Your API key has run out of credits.\n"));
|
|
789
|
+
} else if (errorMessage.includes("401") || errorMessage.includes("Unauthorized")) {
|
|
790
|
+
console.log(chalk3.red("\n\u{1F511} Invalid API key. Run: agdi auth\n"));
|
|
791
|
+
} else {
|
|
792
|
+
console.error(chalk3.red(errorMessage));
|
|
793
|
+
}
|
|
770
794
|
process.exit(1);
|
|
771
795
|
}
|
|
772
796
|
});
|