rder = {
  require(order.status == "Draft", "Invalid status")
  require(order.basket.nonEmpty  , "Basket is empty")

  order.copy(status = "Checkout")
}
```


```scala
checkout(Order(id = 34, status = "Submitted", basket = Nil))
// java.lang.IllegalArgumentException: requirement failed: Invalid status

checkout(Order(id = 34, status = "Draft", basket = Nil))
// java.lang.IllegalArgumentException: requirement failed: Basket is empty
```
]

---
# Solution 1: Exception stack trace

<br>

.eighty-two-left[
```s