@codebakers/cli 1.0.1 → 1.0.2
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 +5 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -155,15 +155,17 @@ function setupCommand(program2) {
|
|
|
155
155
|
const validation = await validateApiKey(apiKey);
|
|
156
156
|
if (!validation.valid) {
|
|
157
157
|
spinner.fail("API key validation failed");
|
|
158
|
-
|
|
158
|
+
const errLower = validation.error?.toLowerCase() || "";
|
|
159
|
+
if (errLower.includes("invalid api key") || validation.error === "HTTP 401") {
|
|
159
160
|
console.log(chalk.red("\nInvalid API key."));
|
|
160
161
|
console.log(chalk.dim("Get your key at: https://codebakers.ai/dashboard"));
|
|
161
|
-
} else if (
|
|
162
|
+
} else if (errLower.includes("enotfound") || errLower.includes("econnrefused") || errLower.includes("unable to connect")) {
|
|
162
163
|
console.log(chalk.red("\nCould not connect to CodeBakers API."));
|
|
163
164
|
console.log(chalk.dim("Check your internet connection and try again."));
|
|
165
|
+
console.log(chalk.dim(`Details: ${validation.error}`));
|
|
164
166
|
} else {
|
|
165
167
|
console.log(chalk.red(`
|
|
166
|
-
|
|
168
|
+
Validation failed: ${validation.error || "Unknown error"}`));
|
|
167
169
|
console.log(chalk.dim("Get your key at: https://codebakers.ai/dashboard"));
|
|
168
170
|
}
|
|
169
171
|
process.exit(1);
|