Complete the code to display the error status code in the error page.
<script>
export let error;
export let status;
</script>
<h1>Error [1]</h1>The {status} variable holds the HTTP status code, which we want to show in the error page heading.
Complete the code to show the error message inside a paragraph.
<script>
export let error;
export let status;
</script>
<p>[1]</p>The error object contains the message property with the error details. We display it using {error.message}.
Fix the error in the script to correctly export the error and status variables.
<script>
let error;
let status;
export [1];
</script>In Svelte, to export multiple variables at once, use export {error, status}; with curly braces and commas.
Fill both blanks to create a conditional block that shows a custom message for 404 errors and a generic message otherwise.
<script>
export let status;
</script>
{#if status [1] 404}
<p>Page not found.</p>
{:else}
<p>Error occurred.</p>
{/if}Use strict equality === to check if status equals 404 for the custom message.
Fill all three blanks to create a reactive statement that logs the error message when the error changes.
<script> export let error; $: if ([1]) { console.log([2].[3]); } </script>
status instead of error.The reactive statement runs when error changes. We check if error exists, then log error.message.