From c76dd21eeb76aa554bc36654ee2001d4eb77710d Mon Sep 17 00:00:00 2001 From: Chris Coutinho Date: Sat, 24 Jan 2026 16:21:57 +0100 Subject: [PATCH] fix(astrolabe): improve error messages for authorization issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace generic "Network error" with specific error messages: - Show backend error message when available from HTTP response - Display "Authorization required. Please complete Step 1 in Settings → Astrolabe." for 401 Unauthorized errors - Show "Search service unavailable" for 503 errors - Keep generic network error only for actual connection failures This helps users understand when they need to complete OAuth authorization vs when there's an actual network problem. Co-Authored-By: Claude Opus 4.5 --- third_party/astrolabe/src/App.vue | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/third_party/astrolabe/src/App.vue b/third_party/astrolabe/src/App.vue index ac98bf6..7c646bf 100644 --- a/third_party/astrolabe/src/App.vue +++ b/third_party/astrolabe/src/App.vue @@ -615,7 +615,20 @@ export default { } } catch (err) { console.error('Search error:', err) - this.error = this.t('astrolabe', 'Network error. Please try again.') + // Check if this is an HTTP error with a response + if (err.response && err.response.data && err.response.data.error) { + // Use the specific error message from the backend + this.error = err.response.data.error + } else if (err.response && err.response.status === 401) { + // Unauthorized - user needs to authorize the app + this.error = this.t('astrolabe', 'Authorization required. Please complete Step 1 in Settings → Astrolabe.') + } else if (err.response && err.response.status === 503) { + // Service unavailable - MCP server not reachable + this.error = this.t('astrolabe', 'Search service unavailable. Please try again later.') + } else { + // Actual network error or unknown error + this.error = this.t('astrolabe', 'Network error. Please try again.') + } this.results = [] } finally { this.loading = false @@ -637,7 +650,14 @@ export default { } } catch (err) { console.error('Status error:', err) - this.statusError = this.t('astrolabe', 'Network error. Please try again.') + // Extract error message from response if available + if (err.response && err.response.data && err.response.data.error) { + this.statusError = err.response.data.error + } else if (err.response && err.response.status === 401) { + this.statusError = this.t('astrolabe', 'Authorization required. Please complete Step 1 in Settings → Astrolabe.') + } else { + this.statusError = this.t('astrolabe', 'Network error. Please try again.') + } } finally { this.statusLoading = false }