fix(astrolabe): improve error messages for authorization issues

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 <noreply@anthropic.com>
This commit is contained in:
Chris Coutinho
2026-01-24 16:21:57 +01:00
parent c5bf4cda8a
commit c76dd21eeb
+22 -2
View File
@@ -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
}