-
Notifications
You must be signed in to change notification settings - Fork 33
[values4k] Forced message in factory #47
Copy link
Copy link
Open
Description
Hello !
I was wondering, what is the purpose of forcing the message ?
forkhandles/values4k/src/main/kotlin/dev/forkhandles/values/ValueFactory.kt
Lines 28 to 36 in a7663a3
| private fun <T> attempt(value: () -> T) = try { | |
| value() | |
| } catch (e: Exception) { | |
| throw IllegalArgumentException( | |
| this::class.java.name.substringBeforeLast('$') + | |
| ": " + e::class.java.name + " " + e.localizedMessage | |
| ) | |
| } | |
| } |
Why not let the client decide what to do with exceptions ?
In my case, I want to throw exceptions in the init of the class, by giving meaningful descriptions. Unfortunately, it gets messed up by this forced behavior.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels