Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[values4k] Forced message in factory #47

Open
tkint opened this issue Jun 22, 2023 · 0 comments · May be fixed by #60
Open

[values4k] Forced message in factory #47

tkint opened this issue Jun 22, 2023 · 0 comments · May be fixed by #60

Comments

@tkint
Copy link
Contributor

tkint commented Jun 22, 2023

Hello !

I was wondering, what is the purpose of forcing the message ?

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.

@MarcusDunn MarcusDunn linked a pull request Apr 3, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant