✨ Improve error handling and formatting in tournament detail component
This commit is contained in:
@@ -108,12 +108,12 @@ const errorMessage = computed(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fallback - try multiple approaches
|
// Fallback - try multiple approaches
|
||||||
|
|
||||||
// Try to get status code directly
|
// Try to get status code directly
|
||||||
if (err.status) {
|
if (err.status) {
|
||||||
return `Error ${err.status}: Request failed`;
|
return `Error ${err.status}: Request failed`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to stringify for debugging
|
// Try to stringify for debugging
|
||||||
try {
|
try {
|
||||||
const errorStr = JSON.stringify(err);
|
const errorStr = JSON.stringify(err);
|
||||||
@@ -124,13 +124,13 @@ const errorMessage = computed(() => {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
// Ignore stringify errors
|
// Ignore stringify errors
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use toString if available and not [object Object]
|
// Use toString if available and not [object Object]
|
||||||
const str = err.toString ? err.toString() : String(err);
|
const str = err.toString ? err.toString() : String(err);
|
||||||
if (str && str !== '[object Object]') {
|
if (str && str !== '[object Object]') {
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.error('Unable to parse error:', err);
|
console.error('Unable to parse error:', err);
|
||||||
return 'An error occurred loading tournament details. Check console for details.';
|
return 'An error occurred loading tournament details. Check console for details.';
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user