2022-04-07 11:28:04 +00:00
|
|
|
<template>
|
2022-09-06 16:21:53 +00:00
|
|
|
<div>
|
|
|
|
{{ state.attr }}
|
|
|
|
{{ data.something }}
|
|
|
|
</div>
|
2022-04-07 11:28:04 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
2022-09-06 16:21:53 +00:00
|
|
|
const { data, error } = await useAsyncData(() => {
|
|
|
|
throw new Error('some error')
|
|
|
|
}, { server: true })
|
|
|
|
|
|
|
|
if (error.value) {
|
2023-04-26 13:36:59 +00:00
|
|
|
useCookie('some-error').value = 'was set'
|
2022-09-06 16:21:53 +00:00
|
|
|
throw createError({ statusCode: 422, fatal: true, statusMessage: 'This is a custom error' })
|
|
|
|
}
|
|
|
|
|
|
|
|
const state = ref({ attr: 'Hello World' })
|
2022-04-07 11:28:04 +00:00
|
|
|
</script>
|