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

Svelte error/isolation/resilience model for components? #6080

Closed
Baxterboom opened this issue Mar 12, 2021 · 2 comments
Closed

Svelte error/isolation/resilience model for components? #6080

Baxterboom opened this issue Mar 12, 2021 · 2 comments

Comments

@Baxterboom
Copy link

Baxterboom commented Mar 12, 2021

I do not understand the "error model" of svelte. Runtime error in one component causes whole app to stop responding. Only way out of it is to reload (f5) the browser. This does not feel resilient to me. IMO only the affected component should fail. Am I thinking about it wrongly, or missed something in the docs about this?

Here is a example demonstrating the case.
https://svelte.dev/repl/f097db80392243ab8edc8a8d6a355e98?version=3.35.0

@dummdidumm
Copy link
Member

What you seem to be looking for are error boundaries. There is an open rfc for it sveltejs/rfcs#46 .
Duplicate of #1096

@Baxterboom
Copy link
Author

Baxterboom commented Apr 2, 2021

Are their any onboarding guides for this project? Not that straight forward how to add/contribute.

Added rudimentary onError event lifecycle to prevent app from locking up, if anyone is interested. Baxterboom#1

`<script lang="ts">
import {onError} from 'svelte';

onError(e => {
    console.warn("onError", e);
    return true;
});

</script>`

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

No branches or pull requests

2 participants