Error

napi.Error is the @teakit/napi error set. It is mapped 1:1 from N-API's napi_status so every distinct N-API failure mode is a distinct named error you can match.

cb.call(env, .{x}) catch |e| switch (e) {
    error.QueueFull => return,        // drop silently
    error.Closing   => return,
    else            => return e,
};

Use it when you want to handle a specific failure mode rather than propagate everything. For the conceptual model, see Errors.

Common members

A non-exhaustive list of values you will see most often:

ErrorWhen
error.PendingExceptionA previous call left a JS exception pending; clear it before continuing.
error.QueueFullThreadsafeFn.call(.non_blocking) could not enqueue.
error.ClosingA ThreadsafeFn is closing and cannot accept calls.
error.StringExpectedA conversion expected a JS string and got something else.
error.NumberExpectedA conversion expected a JS number.
error.BooleanExpectedA conversion expected a JS boolean.
error.ObjectExpectedA conversion expected a JS object.
error.FunctionExpectedA conversion expected a JS function.
error.ArrayExpectedA conversion expected a JS array.
error.BigintExpectedA conversion expected a BigInt.
error.DateExpectedA conversion expected a Date.
error.GenericFailureAn N-API call failed without a more specific code.
error.InvalidArgA call argument was invalid.
error.NameExpectedA property name was expected.

The full set is whatever N-API's napi_status enum contains. New variants get added as Node adds them.

When the bridge throws an error in JS

The bridge catches every error your function returns and converts it to a JS exception (Error with the Zig error name as .message). The same applies to errors raised by argument conversion (error.StringExpected, etc.), which become JS TypeErrors before your function runs.

You only catch @teakit/napi errors when you want to handle them locally rather than let the bridge propagate them.