CrownFramework / svelte-error-boundary

Error Boundaries for Svelte
MIT License
75 stars 5 forks source link

Saving errors, creates a new error #1

Closed ghost closed 3 years ago

ghost commented 3 years ago

So, first off - thank you for creating this.

I do the following

<Boundary onError="{(e) => { window.location.href = '/error'; }}">
Lots of code
</Boundary>

Which works! However, I get the following error which causes a bugsnag report.

Unhandled Promise Rejection: TypeError: undefined is not an object (evaluating 'if_blocks[current_block_type_index].d')

So now, by saving my page from freezing, I'm creating more errors.

ghost commented 3 years ago

This appears to be happening if I do the following:

<Boundary onError="{(e) => { window.location.href = '/error'; }}">
{#if something === true}
.....
{/if}
</Boundary>

However, if I do this it works fine

{#if something === true}
<Boundary onError="{(e) => { window.location.href = '/error'; }}">...</Boundary>
{/if}
jonatansberg commented 3 years ago

Thanks for taking the time to repport this. I published a new version that might fix this, feel free to give it a try!

jonatansberg commented 3 years ago

@bgold0 I can't reproduce this with the new version. Please reopen if you still have problems.

Cheers!