skilldb 0.6.0 → 0.7.0
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/cli.js +20 -2
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +20 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +20 -2
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +59 -7
- package/dist/mcp.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -72,8 +72,26 @@ var SkillDBClient = class {
|
|
|
72
72
|
}
|
|
73
73
|
const res = await fetch(url.toString(), { headers: this.headers() });
|
|
74
74
|
if (!res.ok) {
|
|
75
|
-
const body = await res.json().catch(() =>
|
|
76
|
-
const
|
|
75
|
+
const body = await res.json().catch(() => null);
|
|
76
|
+
const apiError = body && typeof body === "object" ? body.error : null;
|
|
77
|
+
const status = res.status;
|
|
78
|
+
const statusText = res.statusText || "Unknown";
|
|
79
|
+
let msg;
|
|
80
|
+
if (apiError) {
|
|
81
|
+
msg = apiError;
|
|
82
|
+
} else if (status === 500) {
|
|
83
|
+
msg = `SkillDB API internal error (HTTP 500). The service may be experiencing issues. Check status at https://skilldb.dev/api/v1/status`;
|
|
84
|
+
} else if (status === 503) {
|
|
85
|
+
msg = `SkillDB API unavailable (HTTP 503). The skills index may not be loaded. Check status at https://skilldb.dev/api/v1/status`;
|
|
86
|
+
} else if (status === 401) {
|
|
87
|
+
msg = `Invalid or expired API key (HTTP 401). Get a free key at https://skilldb.dev/api-access`;
|
|
88
|
+
} else if (status === 429) {
|
|
89
|
+
msg = `Rate limit exceeded (HTTP 429). Authenticate with an API key for higher limits: https://skilldb.dev/api-access`;
|
|
90
|
+
} else if (status === 404) {
|
|
91
|
+
msg = `Resource not found (HTTP 404). The requested skill or endpoint does not exist.`;
|
|
92
|
+
} else {
|
|
93
|
+
msg = `SkillDB API error: HTTP ${status} ${statusText}. Check https://skilldb.dev/api/v1/status for service health.`;
|
|
94
|
+
}
|
|
77
95
|
throw new Error(msg);
|
|
78
96
|
}
|
|
79
97
|
return res.json();
|