I'm wondering, would it make sense for `error()` ...
# stdlib
p
I'm wondering, would it make sense for
error()
to put exception argument as a cause? For example
error(Exception())
.
👍 1
s
What would be the benefit? That's more characters than
throw Exception()
.
p
I was re-throwing exception, and I accidentally wrote
error(cause)
, so I was wondering, if that could work out of the box
s
What result would you want? Would it
throw IllegalStateException(cause)
or just
throw cause
? The former seems like an okay suggestion but I'm not so keen on the latter.
p
I was thinking about former yeah, if you think that makes sense
j
Unless you add a message argument too, I don't see the point of wrapping the exception. ISE is not particularly specific so it doesn't bring any info
p
That was just a simple example. The actual exception could have various messages and stacktraces 😄
i
It was requested a while ago, but the use case was not clearly described: https://youtrack.jetbrains.com/issue/KT-55613/Add-a-error-function-that-takes-a-cause