⚠️ 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 -->
|
<!-- Error State -->
|
||||||
<div v-else-if="error" class="detail-status error">
|
<div v-else-if="error" class="detail-status error">
|
||||||
<span class="error-icon">⚠️</span>
|
<span class="error-icon">⚠️</span>
|
||||||
<span>{{ error }}</span>
|
<span>{{ errorMessage }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Details Content -->
|
<!-- Details Content -->
|
||||||
@@ -69,7 +69,7 @@ const props = defineProps({
|
|||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
error: {
|
error: {
|
||||||
type: String,
|
type: [String, Error],
|
||||||
default: null
|
default: null
|
||||||
},
|
},
|
||||||
isExpanded: {
|
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
|
* Format tournament details as pretty-printed JSON
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user