Skip to content

Playground error messages are lacking #798

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

Open
benmccann opened this issue Nov 5, 2024 · 6 comments
Open

Playground error messages are lacking #798

benmccann opened this issue Nov 5, 2024 · 6 comments

Comments

@benmccann
Copy link
Member

It took me a long time to figure out what dumb thing I had done in this REPL:

https://svelte.dev/playground/hello-world?version=5.1.9#H4sIAAAAAAAAA3WQT2vDMAzFv4oqBtmoSeg1TQO7DXYZ7Lj04KVqanBsY2vdSsh3L2o71j_rTUjvPf2kAZ3uCUt835JlejUMK80aIumWzdbwDhWujaWE5ceAvAsilgaqX-tzCHk62FHhp070X7_1jslxwhKr1EYTuG5cw6YPPjK86Y5gHX0PWV5Mg-7o5MzmjROdJQaJhQVk3z7alQyq4i_JVYeMQUQjFHXjUCHTD2PJ8YtGdQf-fNkl_tXkzgECNhx_NsICHkL0IT0-za-gRZBLfYO9mdUvZK0_oU-qYjO7oV-Oe9H4FV2pAQAA

The error is simply:

Cannot read properties of undefined (reading 'name')

It would really help to have at least a filename and ideally a line/col as well since multiple files and code locations may contain the same variable name.

@dummdidumm
Copy link
Member

I think for these things it would in general be nice to get the full error message in the browser console

@benmccann
Copy link
Member Author

It appears only for a split second before being cleared:

Screenshot from 2024-11-05 09-44-24

It also never crossed my mind that it would appear there. I assumed the playground was catching all errors and would display them since it is displaying some error message and has its own console. If we could display it in the playground console that could be helpful.

@Rich-Harris
Copy link
Member

I see this, which isn't ideal but doesn't seem completely useless?

image

@Conduitry
Copy link
Member

Firefox and Chromium/V8 have different runtime errors for these sorts of things.

Compare the errors thrown in each from doing something like ({}).a.b.

@benmccann
Copy link
Member Author

The error message is fine. It's the lack of filename, frame, stacktrace, etc. that I think we could improve upon

@newsve
Copy link

newsve commented Jan 13, 2025

In my case playground doesn't show an error within the markup, in particular onclick:

<script lang='ts'>
	import { writable } from 'svelte/store'

	let something = writable(0)   
</script>

<button onclick={() => somthing.update(s => ++s)}>Hello {$something}!</button>

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

No branches or pull requests

5 participants