n8n-nodes-github-copilot 3.31.28 → 3.31.30
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.
|
@@ -242,34 +242,101 @@ class GitHubCopilotOpenAI {
|
|
|
242
242
|
catch (error) {
|
|
243
243
|
if (this.continueOnFail()) {
|
|
244
244
|
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
245
|
+
const errorString = JSON.stringify(error);
|
|
246
|
+
console.error('❌ Error occurred:', errorMessage);
|
|
247
|
+
console.error('❌ Error details:', errorString);
|
|
248
|
+
let cleanMessage = errorMessage;
|
|
249
|
+
cleanMessage = cleanMessage.replace(/\[Token used: [^\]]+\]/g, '').trim();
|
|
250
|
+
cleanMessage = cleanMessage.replace(/\[Attempt: \d+\/\d+\]/g, '').trim();
|
|
251
|
+
cleanMessage = cleanMessage.replace(/^GitHub Copilot API error:\s*/i, '').trim();
|
|
252
|
+
cleanMessage = cleanMessage.replace(/\s+/g, ' ').trim();
|
|
253
|
+
console.log('🧹 Cleaned error message:', cleanMessage);
|
|
254
|
+
let apiError = null;
|
|
255
|
+
try {
|
|
256
|
+
if (error && typeof error === 'object' && 'cause' in error) {
|
|
257
|
+
const cause = error.cause;
|
|
258
|
+
if (cause && cause.error) {
|
|
259
|
+
apiError = cause.error;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
if (!apiError && errorString.includes('{') && errorString.includes('}')) {
|
|
263
|
+
const jsonMatch = errorString.match(/\{[^{}]*"error"[^{}]*\}/);
|
|
264
|
+
if (jsonMatch) {
|
|
265
|
+
apiError = JSON.parse(jsonMatch[0]);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
254
268
|
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
errorCode = "invalid_request";
|
|
269
|
+
catch (parseError) {
|
|
270
|
+
console.error('Failed to parse API error:', parseError);
|
|
258
271
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
272
|
+
let errorType = "invalid_request_error";
|
|
273
|
+
let errorCode = null;
|
|
274
|
+
let errorParam = null;
|
|
275
|
+
let finalMessage = cleanMessage;
|
|
276
|
+
if (apiError && apiError.error) {
|
|
277
|
+
finalMessage = apiError.error.message || cleanMessage;
|
|
278
|
+
errorType = apiError.error.type || errorType;
|
|
279
|
+
errorCode = apiError.error.code || null;
|
|
280
|
+
errorParam = apiError.error.param || null;
|
|
281
|
+
console.log('✅ Using GitHub Copilot API error details');
|
|
262
282
|
}
|
|
263
283
|
else {
|
|
264
|
-
|
|
265
|
-
|
|
284
|
+
const lowerMessage = cleanMessage.toLowerCase();
|
|
285
|
+
if (lowerMessage.includes("403") || lowerMessage.includes("forbidden")) {
|
|
286
|
+
errorType = "invalid_request_error";
|
|
287
|
+
errorCode = "insufficient_quota";
|
|
288
|
+
if (lowerMessage.includes("access") && lowerMessage.includes("forbidden")) {
|
|
289
|
+
finalMessage = "You exceeded your current quota, please check your plan and billing details.";
|
|
290
|
+
}
|
|
291
|
+
else {
|
|
292
|
+
finalMessage = cleanMessage;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
else if (lowerMessage.includes("max") && lowerMessage.includes("token")) {
|
|
296
|
+
errorType = "invalid_request_error";
|
|
297
|
+
errorCode = "context_length_exceeded";
|
|
298
|
+
errorParam = "max_tokens";
|
|
299
|
+
finalMessage = "This model's maximum context length is exceeded. Please reduce the length of the messages or completion.";
|
|
300
|
+
}
|
|
301
|
+
else if (lowerMessage.includes("401") || lowerMessage.includes("unauthorized")) {
|
|
302
|
+
errorType = "invalid_request_error";
|
|
303
|
+
errorCode = "invalid_api_key";
|
|
304
|
+
finalMessage = "Incorrect API key provided. You can find your API key at https://platform.openai.com/account/api-keys.";
|
|
305
|
+
}
|
|
306
|
+
else if (lowerMessage.includes("400") || lowerMessage.includes("bad request")) {
|
|
307
|
+
errorType = "invalid_request_error";
|
|
308
|
+
errorCode = "invalid_request";
|
|
309
|
+
finalMessage = cleanMessage;
|
|
310
|
+
}
|
|
311
|
+
else if (lowerMessage.includes("429") || lowerMessage.includes("rate limit")) {
|
|
312
|
+
errorType = "rate_limit_error";
|
|
313
|
+
errorCode = "rate_limit_exceeded";
|
|
314
|
+
finalMessage = "Rate limit reached. Please wait before making more requests.";
|
|
315
|
+
}
|
|
316
|
+
else if (lowerMessage.includes("timeout")) {
|
|
317
|
+
errorType = "api_error";
|
|
318
|
+
errorCode = "timeout";
|
|
319
|
+
finalMessage = "Request timeout. Please try again.";
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
errorType = "api_error";
|
|
323
|
+
errorCode = "internal_error";
|
|
324
|
+
finalMessage = cleanMessage;
|
|
325
|
+
}
|
|
326
|
+
console.log('⚠️ Using fallback error detection with cleaned message');
|
|
266
327
|
}
|
|
328
|
+
console.log('📋 Final error format:', {
|
|
329
|
+
message: finalMessage,
|
|
330
|
+
type: errorType,
|
|
331
|
+
param: errorParam,
|
|
332
|
+
code: errorCode,
|
|
333
|
+
});
|
|
267
334
|
returnData.push({
|
|
268
335
|
json: {
|
|
269
336
|
error: {
|
|
270
|
-
message:
|
|
337
|
+
message: finalMessage,
|
|
271
338
|
type: errorType,
|
|
272
|
-
param:
|
|
339
|
+
param: errorParam,
|
|
273
340
|
code: errorCode,
|
|
274
341
|
},
|
|
275
342
|
},
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-github-copilot",
|
|
3
|
-
"version": "3.31.
|
|
3
|
+
"version": "3.31.30",
|
|
4
4
|
"description": "n8n community node for GitHub Copilot with CLI integration, Chat API access, and AI Chat Model for workflows - access GPT-5, Claude, Gemini and more using your Copilot subscription",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/sufficit/n8n-nodes-github-copilot",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-github-copilot",
|
|
3
|
-
"version": "3.31.
|
|
3
|
+
"version": "3.31.30",
|
|
4
4
|
"description": "n8n community node for GitHub Copilot with CLI integration, Chat API access, and AI Chat Model for workflows - access GPT-5, Claude, Gemini and more using your Copilot subscription",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/sufficit/n8n-nodes-github-copilot",
|