# tx.run_must_fail · Rell standard library · Chromia Docs (concept)

> function run_ must_ fail(): failure Build a test block containing only this test transaction, asserting that the building fails
(i.e. throws an exception).

Source: https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/rell.test/tx/run_must_fail/

FUNCTION

# tx.run\_must\_fail

```signature
function run_must_fail(): failure
```

Build a test block containing only this test transaction, asserting that the building fails
(i.e. throws an exception).

Typically used to test operation calls that must throw an exception.

Since 0.10.4

---

```signature
function run_must_fail(expected_message: text): failure
```

Build a test block containing only this test transaction, asserting that the building fails;
i.e. throws an exception; with the given exception message.

Checks that the given message is a substring of the thrown message. For example
`my_tx.run_must_fail('out of bounds')` succeeds if an exception with message
`Run-time error: List index out of bounds: 0 (size 0)` is thrown.

Typically used to test operation calls that must throw an exception.

**Parameters**

* **expected\_message** — the expected substring of the error message

Since 0.11.0

[View this page on docs.chromia.com](https://docs.chromia.com/pages/rell-stdlib/-rell%20-system%20-library/rell.test/tx/run_must_fail.html)Generated API reference, mirrored from the live docs
