Stop Throwing Errors. Awaitly Makes Async Error Handling Actually Work
22 Jan 2026
We've all written this code:
const lambdaHandler = async () => {
try {
const db = await connectToDb();
const result = await errorHandler({ taskId, error }, { db });
return { statusCode: 200, body: { message: 'Success', task: result } };
} catch (error) {
return { statusCode: 500, body: { message: 'Error' } };
}
}
That catch (error) swallows everything. Was it a "task not found"? A database connection failure? A permissions issue? Who knows.
Throwing exceptions for expected failures is like using GOTO. You lose the thread.
Awaitly fixes this by treating errors as data, not explosions. This guide teaches the patterns one concept at a time.
Read More →