naystack - v1.5.10
    Preparing search index...

    Type Alias ErrorHandler

    ErrorHandler: (error: { message: string; status: number }) => NextResponse

    Custom error handler for auth routes. Return a NextResponse to send a custom error; otherwise the default response is used.

    Type Declaration

      • (error: { message: string; status: number }): NextResponse
      • Parameters

        • error: { message: string; status: number }

          Object with status (HTTP code) and message (error text).

        Returns NextResponse

        NextResponse to override the default error, or undefined to use the default.

    const onError: ErrorHandler = ({ status, message }) => {
    if (status === 400) return NextResponse.json({ error: message }, { status: 400 });
    return undefined; // Use default handling
    };