0
0
Svelteframework~5 mins

Error pages (+error.svelte) - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of the +error.svelte file in a SvelteKit project?
The +error.svelte file defines a custom error page that shows when a route fails or an error occurs. It helps display friendly messages instead of default browser errors.
Click to reveal answer
beginner
How do you access the error details inside +error.svelte?
You receive an error and status prop automatically. Use these to show the error message and HTTP status code on the page.
Click to reveal answer
intermediate
What HTTP status codes can trigger the +error.svelte page in SvelteKit?
Any HTTP error status like 404 (Not Found), 500 (Server Error), or custom errors can trigger the +error.svelte page to display.
Click to reveal answer
beginner
Can you customize the look and content of the +error.svelte page?
Yes! You can style it with CSS and add any HTML or Svelte code to make the error page user-friendly and match your app's design.
Click to reveal answer
beginner
What happens if you don't create a +error.svelte file in your SvelteKit app?
SvelteKit shows a default plain error page with minimal info. Creating +error.svelte lets you provide a better user experience.
Click to reveal answer
What props does +error.svelte receive automatically?
Adata and params
Bmessage and code
Crequest and response
Derror and status
Which file name triggers a custom error page in SvelteKit?
AerrorPage.svelte
Berror.svelte
C+error.svelte
D+404.svelte
If a route returns a 404 error, what happens in SvelteKit if +error.svelte exists?
AThe +error.svelte page is shown with the 404 status
BThe browser default 404 page is shown
CThe app crashes
DNothing happens
Can you add custom styles to +error.svelte?
AYes, you can style it like any Svelte component
BNo, styles are not allowed
COnly inline styles work
DYou must use global CSS only
What is the default behavior if +error.svelte is missing?
AThe app redirects to homepage
BSvelteKit shows a simple default error page
CThe app crashes with no message
DThe error is ignored
Explain how +error.svelte works in SvelteKit and how you can use it to improve user experience.
Think about what happens when a page fails to load and how you want to show that to users.
You got /5 concepts.
    Describe the steps to create a custom error page using +error.svelte in a SvelteKit app.
    Focus on file creation, props usage, and testing.
    You got /5 concepts.