Skip to content

Svelte errors from jsdom attempting to run code after tossr promise returns #14

@mizzao

Description

@mizzao

Now that tossr is printing out errors properly (#11), it can still be hard to debug because they look like this:

Unhandled promise rejection:
TypeError: Cannot read property 'dispatchEvent' of undefined
    at Object.dispatch_dev10 (eval at <anonymous> (/home/mao/parsnip/cookwithme/node_modules/tossr/tossr.js:91:24), <anonymous>:10399:16)
    at create_if_block_1$12 (eval at <anonymous> (/home/mao/parsnip/cookwithme/node_modules/tossr/tossr.js:91:24), <anonymous>:5010:14)
    at create_fragment$22 (eval at <anonymous> (/home/mao/parsnip/cookwithme/node_modules/tossr/tossr.js:91:24), <anonymous>:5075:38)
    at Object.init10 (eval at <anonymous> (/home/mao/parsnip/cookwithme/node_modules/tossr/tossr.js:91:24), <anonymous>:10360:41)
    at new PhaseCard (eval at <anonymous> (/home/mao/parsnip/cookwithme/node_modules/tossr/tossr.js:91:24), <anonymous>:5225:16)
    at create_fragment$32 (eval at <anonymous> (/home/mao/parsnip/cookwithme/node_modules/tossr/tossr.js:91:24), <anonymous>:5301:19)
    at Object.init10 (eval at <anonymous> (/home/mao/parsnip/cookwithme/node_modules/tossr/tossr.js:91:24), <anonymous>:10360:41)
    at new U5BrecipeIdu5D (eval at <anonymous> (/home/mao/parsnip/cookwithme/node_modules/tossr/tossr.js:91:24), <anonymous>:5435:16)
    at Array.create_default_slot2 (eval at <anonymous> (/home/mao/parsnip/cookwithme/node_modules/tossr/tossr.js:91:24), <anonymous>:11562:27)
    at create_slot3 (eval at <anonymous> (/home/mao/parsnip/cookwithme/node_modules/tossr/tossr.js:91:24), <anonymous>:9618:29)

Is this because jsdom is running everything in an eval? If so, is there any way to bubble up the underlying code? Because it's really hard to see what line this error is referring to 😁. There is no dispatchEvent in my code so I think it might even be from a Svelte timing issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions