From f11ca388f884494a91d0f19722e730a555119c05 Mon Sep 17 00:00:00 2001 From: FragginWagon Date: Thu, 29 Jan 2026 14:33:07 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Improve=20error=20handling=20and?= =?UTF-8?q?=20messaging=20for=20tournament=20detail=20loading?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/challonge/TournamentDetail.vue | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/code/websites/pokedex.online/src/components/challonge/TournamentDetail.vue b/code/websites/pokedex.online/src/components/challonge/TournamentDetail.vue index 2c7bf62..a50219c 100644 --- a/code/websites/pokedex.online/src/components/challonge/TournamentDetail.vue +++ b/code/websites/pokedex.online/src/components/challonge/TournamentDetail.vue @@ -84,7 +84,29 @@ const props = defineProps({ const errorMessage = computed(() => { if (!props.error) return ''; if (typeof props.error === 'string') return props.error; - return props.error.message || 'An error occurred'; + + // Try to extract useful error info + const err = props.error; + if (err.message) { + // Check if it's a network error + if (err.message.includes('Load failed') || err.message.includes('fetch')) { + return 'Failed to load tournament details. Check your network connection or API credentials.'; + } + return err.message; + } + + // Check for response errors + if (err.response) { + const status = err.response.status || err.status; + if (status === 401) return 'Authentication failed. Check your API key.'; + if (status === 403) return 'Access forbidden. You may not have permission to view this tournament.'; + if (status === 404) return 'Tournament not found.'; + if (status >= 500) return `Server error (${status}). Please try again later.`; + return `Error ${status}: ${err.response.statusText || 'Request failed'}`; + } + + // Fallback + return err.toString() || 'An error occurred loading tournament details'; }); /**