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