fun updateOrderQuanity(orderId: OrderId, quantity: Int) {
require(quantity > 0) { "Quantity must be positive" }
val order = loadOrder(orderId)
order.quantity = quantity
storeOrder(order)
}
It is safe to assume that when we are creating a top-level-handler
Dedicate a single top-level place in your code to address all network errors uniformly
Here we actual also refer to
IOExceptions
and
IllegalArgumentExceptions
(and any other input/output exceptions)?
Thanks in advance for any answers !
George
11/10/2022, 3:10 PM
Based on my understading i would say yes. Since i think we can treat
IllegalArgumentException
as an input problem. For example: when someone sends a bad format dto we should/can throw
IllegalArgumentException
. Probably that's why (imho) i think kotlinx.serialization also extends