Kotlin has :one: `check(…)` and :two: `require(…)`...
# codereview
h
Kotlin has 1️⃣
check(…)
and 2️⃣
require(…)
. Which would be better to signal an invalid configuration (i.e. on startup)? Or should I make up 3️⃣ my own exception class? I'm really torn between "a bad config is an illegal argument" and "the app is in an illegal state and can't start" 😕
z
Where’s the configuration coming from? If it’s read from a file or some other external resource, I would argue that IAE is definitely the wrong thing since that exception explicitly means a bad argument was passed to a function. Not sure if ISE would necessarily be any more correct either though.
h
Yep, external config (k8s template).
z
I would probably make a dedicated exception (inheriting from
RuntimeException
probably)
1