Error-first callbacks carry failure and success through separate arguments. Centralizing the error check makes the success path easier to inspect.
Worked example
import assert from "node:assert/strict";
console.log((assert.ifError(null), "passed"));Result
passedImplementation notes
Returning immediately after handling an error prevents the success path from trying to use a missing result.
Try it yourself
Call the handler with an error and with a legitimate falsy result.
Open the Node.js example →Editorial date January 16, 2026 · Published December 6, 2026