Skip to content

RoutingError

The error class thrown by notFound(), unauthorized(), forbidden(), and httpError(). Check for it in +error.tsx+error.jsx to distinguish routing errors from GraphQL errors.

class RoutingError extends Error {
status: number
}
import { RoutingError } from '$houdini'
import type { ErrorProps } from './$types'
export default function PageError({ errors }: ErrorProps) {
const routing = errors.find((e) => e instanceof RoutingError) as RoutingError | undefined
if (routing?.status === 404) return <p>Not found.</p>
if (routing?.status === 401) return <p>Please log in.</p>
return <p>Something went wrong.</p>
}