You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* [breaking] add error.html
This is a static error page that will be rendered by the server when everything else goes wrong
Closes#3068
* await native navigations to prevent content flashes
* thank you test for uncovering my inability to set the response's content-type
* error page can retrieve status / message
* fix test
* shhh
* note placeholders
* move default error template into separate file
* add some super basic css
* fix test
* rename options
* remove error.html from create-svelte
* fix tests
* rename internal, too
* fixes
* Update documentation/docs/03-routing.md
Co-authored-by: Rich Harris <hello@rich-harris.dev>
Co-authored-by: Rich Harris <richard.a.harris@gmail.com>
Copy file name to clipboardExpand all lines: documentation/docs/01-project-structure.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,7 @@ my-project/
14
14
│ ├ routes/
15
15
│ │ └ [your routes]
16
16
│ ├ app.html
17
+
│ ├ error.html
17
18
│ └ hooks.js
18
19
├ static/
19
20
│ └ [your static assets]
@@ -41,6 +42,9 @@ The `src` directory contains the meat of your project.
41
42
-`%sveltekit.body%` — the markup for a rendered page. Typically this lives inside a `<div>` or other element, rather than directly inside `<body>`, to prevent bugs caused by browser extensions injecting elements that are then destroyed by the hydration process
42
43
-`%sveltekit.assets%` — either [`paths.assets`](/docs/configuration#paths), if specified, or a relative path to [`paths.base`](/docs/configuration#base)
43
44
-`%sveltekit.nonce%` — a [CSP](/docs/configuration#csp) nonce for manually included links and scripts, if used
45
+
-`error.html` (optional) is the page that is rendered when everything else fails. It can contain the following placeholders:
46
+
-`%sveltekit.status%` — the HTTP status
47
+
-`%sveltekit.message%` — the error message
44
48
-`hooks.js` (optional) contains your application's [hooks](/docs/hooks)
45
49
-`service-worker.js` (optional) contains your [service worker](/docs/service-workers)
Copy file name to clipboardExpand all lines: documentation/docs/03-routing.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -190,7 +190,7 @@ If an error occurs during `load`, SvelteKit will render a default error page. Yo
190
190
<h1>{$page.status}: {$page.error.message}</h1>
191
191
```
192
192
193
-
SvelteKit will 'walk up the tree' looking for the closest error boundary — if the file above didn't exist it would try `src/routes/blog/+error.svelte` and `src/routes/+error.svelte` before rendering the default error page.
193
+
SvelteKit will 'walk up the tree' looking for the closest error boundary — if the file above didn't exist it would try `src/routes/blog/+error.svelte` and `src/routes/+error.svelte` before rendering the default error page. If _that_ fails, SvelteKit will bail out and render a static fallback error page, which you can customise by creating a `src/error.html` file.
0 commit comments