Exception
```

```scala
def checkout(order: Order): Order =
  if (order.status != "Draft")   throw InvalidStatus(order.status)
  else if (order.basket.isEmpty) `throw EmptyBasket`
  else
    order.copy(status = "Checkout")
```

```scala
Try(checkout(order)).recover {
  `case EmptyBasket` => order // ignore this error
}
```
]

---
# Java checked exception

<br>

.eighty-two-left[
```scala
case class InvalidStatus(currentStatus: String) extends Exception
case object EmptyBasket extends Exception
```

```java
