Skip to content

Commit 00edf38

Browse files
committed
Improvement - VueDataUi universal component - Improve error messages
1 parent cdfc3d9 commit 00edf38

File tree

1 file changed

+30
-3
lines changed

1 file changed

+30
-3
lines changed

src/components/vue-data-ui.vue

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -358,14 +358,41 @@ defineExpose({
358358
toggleAnimation,
359359
toggleAnnotator
360360
});
361+
362+
const notSupported = computed(() => {
363+
let message = `The provided component ${props.component} does not exist.`;
364+
if (['VueUiIcon', 'VueUiPattern', 'Arrow'].includes(props.component)) {
365+
message = `${props.component} is not supported by the VueDataUi universal component. You must import it individually.`;
366+
console.warn(message);
367+
return {
368+
status: 'notSupported',
369+
message
370+
}
371+
}
372+
console.warn(message);
373+
return {
374+
status: 'unknown',
375+
message
376+
}
377+
})
378+
361379
</script>
362380

363381
<template>
364-
<div v-if="isError" style="width:100%; display: flex; gap:6px; align-items:center; color:#FF0000">
382+
<div
383+
v-if="isError"
384+
:style="{
385+
width:'100%',
386+
display: 'flex',
387+
gap:'6px',
388+
alignItems: 'center',
389+
color: notSupported.status === 'notSupported' ? '#FF9000' : '#FF0000'
390+
}">
365391
<div style="width:36px">
366-
<BaseIcon name="moodFlat" stroke="#FF0000" />
392+
<BaseIcon name="moodFlat" v-if="notSupported.status === 'unknown'" stroke="#FF0000" />
393+
<BaseIcon name="circleExclamation" v-if="notSupported.status === 'notSupported'" stroke="#FF9000" />
367394
</div>
368-
The provided component "{{ component }}" does not exist
395+
{{ notSupported.message}}
369396
</div>
370397

371398
<component

0 commit comments

Comments
 (0)