Kingston2019
Kingston2019
NNuxt
Created by Kingston2019 on 3/27/2024 in #❓・help
Error.vue not working with createError?
https://github.com/CodeDredd/h3-compression/issues/4 it turns out it was this. Super cool!
5 replies
NNuxt
Created by Kingston2019 on 3/27/2024 in #❓・help
Error.vue not working with createError?
Thanks for that. I boiled it down to a server compression plugin I was using: import { useCompression } from 'h3-compression' export default defineNitroPlugin((nitro) => { nitro.hooks.hook('render:response', async (response, { event }) => { if (!response.headers?.['content-type'].startsWith('text/html')) return await useCompression(event, response) }) }) Any idea why that would cause the error to break?
5 replies
NNuxt
Created by Kingston2019 on 3/27/2024 in #❓・help
Error.vue not working with createError?
I tried it and it still doesnt, still shows the default browser error page. This was my code: const { data: page } = await useAsyncData(page-${route.params.title}, () => { return $directus.request($readItem('Pages', route.params.title, { fields: ['', 'Page_Content....*'] })) }) if (!page.value) { showError({ fatal:true, statusCode: 404, statusMessage: 'Page Not Found',
}) }
5 replies
NNuxt
Created by Kingston2019 on 3/27/2024 in #❓・help
Error.vue not working with createError?
It's the same result with showError. In my terminal it shows: ERROR [nuxt] [request error] [fatal] [404] Page Not Found for both. And I can change the code and it will correctly report the new code. It just doesnt take me to the error.vue page which is what I thought it would do.
5 replies