⚠️ Update error handling to support both string and Error object types in TournamentDetail component
This commit is contained in:
@@ -35,7 +35,7 @@
|
||||
<!-- Error State -->
|
||||
<div v-else-if="error" class="detail-status error">
|
||||
<span class="error-icon">⚠️</span>
|
||||
<span>{{ error }}</span>
|
||||
<span>{{ errorMessage }}</span>
|
||||
</div>
|
||||
|
||||
<!-- Details Content -->
|
||||
@@ -69,7 +69,7 @@ const props = defineProps({
|
||||
default: false
|
||||
},
|
||||
error: {
|
||||
type: String,
|
||||
type: [String, Error],
|
||||
default: null
|
||||
},
|
||||
isExpanded: {
|
||||
@@ -78,6 +78,15 @@ const props = defineProps({
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Format error message from string or Error object
|
||||
*/
|
||||
const errorMessage = computed(() => {
|
||||
if (!props.error) return '';
|
||||
if (typeof props.error === 'string') return props.error;
|
||||
return props.error.message || 'An error occurred';
|
||||
});
|
||||
|
||||
/**
|
||||
* Format tournament details as pretty-printed JSON
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user