---
title: "U3007: Fallible expression without handling"
url: https://una-lang.org/en/docs/errors/U3007/
release: v0.4.0
source: https://github.com/una-lang/una/blob/v0.4.0/crates/una-explain/explain/U3007.md
---

# U3007: Fallible expression without handling

Failures never propagate implicitly: a statement, `let` or final expression that can fail is followed by an `if error` clause, or its call is wrapped in `attempt` (`spec/06 §3, §5`). `if error fail V` turns the failure into a variant of the function's error kind, `if error pass` propagates it unchanged when the kinds are equal, and `if error use e` recovers with a value. The message names the call and the error kind it can fail with.

## The repair at a glance

```diff
  module demo

  kind StoreError = Timeout | Corrupted

  capability Store
    op find(key: Int) -> Option[Int]
      fails StoreError

  pub has(key: Int) -> Bool
    uses @store: Store[find]
  =
    let found = @store.find(key)
+     if error use None
    found.is_some()
```

## Failing example

```una
module demo

kind StoreError = Timeout | Corrupted

capability Store
  op find(key: Int) -> Option[Int]
    fails StoreError

pub has(key: Int) -> Bool
  uses @store: Store[find]
=
  let found = @store.find(key)
  found.is_some()
```

## Fixed example

```una
module demo

kind StoreError = Timeout | Corrupted

capability Store
  op find(key: Int) -> Option[Int]
    fails StoreError

pub has(key: Int) -> Bool
  uses @store: Store[find]
=
  let found = @store.find(key)
    if error use None
  found.is_some()
```
