Errors and nulls Required
Await every async call
Await every promise, task or future, or hand it to code that handles its errors. A call that nobody waits for loses its errors without a trace.
How to do it
Use one async style across the codebase, such as async and await, instead of mixing callbacks and promise chains. When work must run in the background, pass it to a queue or a task runner that logs failures.
Example
// Bad: if sending fails, nobody ever knows
function placeOrder(order: Order) {
saveOrder(order);
sendConfirmation(order);
}
// Good: errors reach the caller
async function placeOrder(order: Order) {
await saveOrder(order);
await sendConfirmation(order);
}
How to check
A linter fails on unhandled async calls. Examples are typescript-eslint no-floating-promises and no-misused-promises, and Ruff RUF006 for asyncio tasks.
For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers architecture playbook: https://agentwranglers.se/playbook/architecture/errors-and-nulls/await-every-promise.