Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1541

+error.svelte page does not display upon server-side error detection

$
0
0

My files structure is this:

/routes├── [slug]│├──+page.svelte├── portfolio/[slug]│├──+error.svelte│└──+page.svelte├──+error.svelte├──+layout.server.js├──+layout.svelte├──+page.svelte└──+server.js

In layout.server.js I check URLs to send the correct data (not sure it's the right way but so far so good):

// +layout.server.jsimport { error } from '@sveltejs/kit';export async function load({ url }) {    //...run some code    if(urlNotfound) {            throw error(404, 'Not found here');    }    return { correctData };}

I want the correct (or at least any) +error.svelte page to display but none of them is shown. I keep having the native error page. Why?


Viewing all articles
Browse latest Browse all 1541

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>