Hello folks, after reading this article from roman...
# codingconventions
g
Hello folks, after reading this article from roman: https://elizarov.medium.com/kotlin-and-exceptions-8062f589d07 i have a question: On the section about input/output particular, since the example is:
Copy code
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 !
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
IllegalArgumentException
as the root if its exception hierarchy