svelte: bug: is not working on SSR

Describe the bug

The <svelte:boundary> do nothing on SSR !

On the REPL we can see that code like this :

<svelte:boundary>
	template
	{#snippet failed()}
		error
	{/snippet}
</svelte:boundary>

Will generate this server code :

	{
		function failed($$payload) {
			$$payload.out += `<!---->error`;
		}

		$$payload.out += `<!---->template`;
	}

The template is written, but there no try/catch and the failed() snippet is never caller when an error occurs in the template !

Actually this will produce an HTTP 500 error 😦

I think it should render the failed() snippet instead…

Reproduction

Click on the links ā€œBad pageā€ and ā€œGood pageā€ to see that the error is handheld on client-site. Then, when on the ā€œBad pageā€, click on the ā€œreload to force SSRā€ button to regenerate the page via SSR… => HTTP 500

https://www.sveltelab.dev/ravzziihmogkq1a

Logs


System Info

Done on sveltelabs with last version

Severity

annoyance

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 17 (16 by maintainers)

Most upvoted comments

Yes but +error.svelte is for HTTP errors, and I don’t want to render an HTTP error…

I just want to render the page correctly, without the svelte:boundary part when it fail… Like with a try/catch…

But IMHO I think the SSR should generate the same result… It’s incorrect to generate an HTTP 500 in this case.