-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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' is not defined" when using try/catch in event handler #3064
Labels
Comments
trbrc
added a commit
to trbrc/svelte-inspect
that referenced
this issue
Jun 21, 2019
To avoid github.com/sveltejs/svelte/issues/3064
Adding |
Rich-Harris
added a commit
that referenced
this issue
Jun 24, 2019
Rich-Harris
added a commit
that referenced
this issue
Jun 25, 2019
add Error to known globals, declare catch block parameter
Both fixed in 3.6.0 |
This was referenced Sep 17, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The compiler does not appear to understand that in
try {...} catch (error) {...}
,error
declares a new variable. Instead, it complains that'error' is not defined
.https://svelte.dev/repl/b630939cfcc243ce8d46bfe1218dcfb4?version=3.5.3
In creating the above reproduction, I noticed it also doesn't recognise the global
Error
in this context.The text was updated successfully, but these errors were encountered: