From 4269acfc2746920c9a2970f532988a485f0bd635 Mon Sep 17 00:00:00 2001 From: octo-patch Date: Sat, 25 Apr 2026 09:33:11 +0800 Subject: [PATCH] fix: surface actual API errors instead of generic 'No valid XML' message (fixes #493) When wiki generation fails due to upstream API errors (e.g. rate limiting 429), the frontend now extracts and displays the actual error from the response text. Previously, all failures without valid XML were shown as 'No valid XML found in response', which misled users into thinking their repository URL was wrong. Co-Authored-By: Octopus --- src/app/[owner]/[repo]/page.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/app/[owner]/[repo]/page.tsx b/src/app/[owner]/[repo]/page.tsx index 98ffc6fbc..cadbad5e0 100644 --- a/src/app/[owner]/[repo]/page.tsx +++ b/src/app/[owner]/[repo]/page.tsx @@ -945,6 +945,15 @@ IMPORTANT: // Extract wiki structure from response const xmlMatch = responseText.match(/[\s\S]*?<\/wiki_structure>/m); if (!xmlMatch) { + // Surface the actual API error instead of a generic message + const apiErrorMatch = responseText.match(/Error with [\w][\w ]*API:\s*[^\n]+/); + if (apiErrorMatch) { + throw new Error(apiErrorMatch[0].trim()); + } + const generalErrorMatch = responseText.match(/\nError:\s*[^\n]+/); + if (generalErrorMatch) { + throw new Error(generalErrorMatch[0].trim()); + } throw new Error('No valid XML found in response'); }