I shot myself in a foot a bit with following code....
# detekt
p
I shot myself in a foot a bit with following code. Would rule for that make sense?
error(exception)
m
Could you elaborate a bit more what you mean?
p
I guess proper way should be
throw IllegalStateException(exception)
, so you properly set stacktrace cause?
error(cause)
is the same as writing
throw IllegalStateException(exception.toString())
m
That does sound like a good rule.
b
Oh, because
error
receives
Any
and you passed the exception and instead of using it as a cause it just called the
toString
. Right?
p
yeah, that's how it's implemented
b
Yeap! That looks like a good rule for detekt.
p
Ok, will open GitHub issue after work