Question · Svelte and SvelteKit course · Module 11: SvelteKit Routing

A 404 Error in load

How do you raise a 404 error in a load function (SvelteKit 3)?

Answer options

  • return { status: 404 }
  • error(404, 'Not found')
  • throw new Error(404)
  • redirect(404)

You can check the correct answer by solving this task in the CodeWorlds game.