Docs
Types

KizloError

The error type Kizlo throws and your error maps produce.

A KizloError is the error Kizlo throws across the framework. The throwable functions from createThrowableErrorMap return one, and you can construct one directly. It carries a stable code, an HTTP status, and an optional data payload alongside the standard Error message.

Prop

Type

Constructing

new KizloError(code, options?)

The first argument is the code; the rest come from options, each with a sensible fallback (a known common code fills in its preset status and message):

Prop

Type

import { KizloError } from "kizlo"

throw new KizloError("NOT_FOUND", { message: "Post not found" })

Detecting

isKizloError(value) narrows an unknown value to KizloError. It matches a real instance or any object with the KizloError shape, so it survives serialization across a boundary. toKizloError(value) normalizes any thrown value into a KizloError, falling back to INTERNAL_SERVER_ERROR.

On this page