Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error thrown while rendering $error.svelte. #996

Closed
Leftium opened this issue Apr 13, 2021 · 1 comment · Fixed by #1021
Closed

Error thrown while rendering $error.svelte. #996

Leftium opened this issue Apr 13, 2021 · 1 comment · Fixed by #1021

Comments

@Leftium
Copy link

Leftium commented Apr 13, 2021

Describe the bug
SvelteKit throws error when rendering $error.svelte:

TypeError: Cannot read property 'message' of undefined

Logs
See stack trace below.

To Reproduce: https://github.com/Leftium/errorkit

npm init svelte@next
yarn
# edit $layout.svelte so `LoadOutput` returned by `load({ page, fetch, session, context })` always results in error.
# Tried:
# 1. Setting LoadoutOutput.error to both new Error() and string.
# 2. Also tried editing index.svelte.

Expected behavior

Svelte's error template should be rendered.

Stacktraces

Stack trace
TypeError: Cannot read property 'message' of undefined
    at eval (D:\tmp\errorkit\.svelte\dev\components\error.svelte:15:41)
    at Object.$$render (D:\tmp\errorkit\node_modules\svelte\internal\index.js:1369:22)
    at Object.default (/D:\tmp\errorkit\.svelte\dev/generated/root.svelte:57:127)
    at eval (D:\tmp\errorkit\src\routes\$layout.svelte:11:41)
    at Object.$$render (D:\tmp\errorkit\node_modules\svelte\internal\index.js:1369:22)
    at eval (/D:\tmp\errorkit\.svelte\dev/generated/root.svelte:55:122)
    at $$render (D:\tmp\errorkit\node_modules\svelte\internal\index.js:1369:22)
    at Object.render (D:\tmp\errorkit\node_modules\svelte\internal\index.js:1377:26)
    at render_response (file:///D:/tmp/errorkit/node_modules/@sveltejs/kit/dist/ssr.js:377:28)
    at async respond_with_error (file:///D:/tmp/errorkit/node_modules/@sveltejs/kit/dist/ssr.js:2572:10)

Information about your SvelteKit Installation:

Diagnostics
  • The output of npx envinfo --system --npmPackages svelte,@sveltejs/kit,vite --binaries --browsers

    System:
    OS: Windows 10 10.0.19041
    CPU: (8) x64 Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
    Memory: 11.14 GB / 23.86 GB
    Binaries:
    Node: 14.16.0 - D:\DropBox\a\nodejs\64v14.16.0\node.EXE
    Yarn: 1.22.4 - D:\dropbox\home.yarn\bin\yarn.CMD
    npm: 6.14.11 - D:\DropBox\a\nodejs\64v14.16.0\npm.CMD
    Browsers:
    Edge: Spartan (44.19041.423.0), Chromium (89.0.774.75)
    Internet Explorer: 11.0.19041.1
    npmPackages:
    @sveltejs/kit: next => 1.0.0-next.74
    svelte: ^3.29.0 => 3.37.0
    vite: ^2.1.0 => 2.1.5

  • Your browser: Chrome

  • Your adapter (e.g. Node, static, Vercel, Begin, etc...): Node

Severity
Not too severe. It just makes it harder to debug SvelteKit projects, and the error output isn't as nice/graceful.

Additional context
Add any other context about the problem here.

@AviDuda
Copy link

AviDuda commented Apr 13, 2021

This was changed yesterday to support nested error components (commit 1007f67), it looks like for now you need to use the load method as shown here in the example.
Later, this should be available via $app/stores (see #901).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants