24 lines
644 B
Vue
24 lines
644 B
Vue
<script setup lang="ts">
|
|
import ShikiHighlight from '~/components/Markdown/ShikiHighlight.vue';
|
|
|
|
const props = defineProps<{
|
|
error: string | null | undefined;
|
|
}>();
|
|
|
|
const code: Ref<string | null> = ref(null);
|
|
|
|
if (props.error !== null && props.error !== undefined) {
|
|
try {
|
|
code.value = JSON.stringify(JSON.parse(props.error!), null, 2);
|
|
} catch (e) {
|
|
code.value = props.error;
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<span class="text-sm text-[var(--color-error)]">Generation failed</span>
|
|
<div class="text-sm">
|
|
<ShikiHighlight :code="code ?? 'An unknown error occurred'" lang="json" />
|
|
</div>
|
|
</template> |