 3. Mixed result

---
# What do we do with an error?

<br>

## 1. Report it

## 2. Recover (retry, fallback)

---
# Solution 1: Exception

<br>

```scala mdoc:invisible
case class Order(id: Long, status: String, basket: List[Item])
case class Item(id: Long, quantity: Int, unitPrice: Double)
```

.eighty-two-left[
```scala mdoc
def checkout(order: Order): Order =
  if (order.status != "Draft")   throw new Exception("Invalid status")
  else if (order.basket.isEmpty) throw new Exception("Basket is empty")
  el