# assertThrowsErrorAsync Source: https://smartassertions.dev/assertions/assertThrowsErrorAsync/ Index of every page: https://smartassertions.dev/llms.txt Assertion function that verifies an async function throws an error. Returns the thrown error for further assertions. ## Usage ```ts import { assertThrowsErrorAsync } from "@kensio/smartass"; const error = await assertThrowsErrorAsync(async () => loadUser("missing")); // error is returned as Error; this assertion does not narrow another value. ``` ## Source Source file: [`src/assert/throws-error-async/throws-error-async.assert.ts`](https://github.com/KensioSoftware/smartass/blob/main/src/assert/throws-error-async/throws-error-async.assert.ts)