<https://blog.shreyaspatil.dev/kotlin-exception-ha...
# feed
e
exceptions can be created without a stack trace, which would also prevent them from being misleading
s
I once ran into this, too. ๐Ÿ˜„ What use do Exceptions without a stack trace have?
I feel Detekt should have a rule for singleton/`object` Exceptions.
e
control flow exceptions that aren't exposed to the user
s
Ok, I see. Control flow exceptions are considered being an anti-pattern in my world. ๐Ÿ˜‰
( No, I don't have an alternative for CancellationException ๐Ÿ˜… )
p
@Stefan Oltmann Detekt has the rule ๐Ÿค“ https://detekt.dev/docs/rules/exceptions/#objectextendsthrowable
๐Ÿ‘ 2
๐ŸŽ‰ 1
c
Control flow exceptions are considered being an anti-pattern in my world.
Actually it's the opposite way around ๐Ÿ˜… Control flow exceptions are bad because their stacktrace is expensive If you disable stacktraces, and carefully write a DSL so the exception cannot "leak", you can use them fairly safely as a sort of more powerful non-local return The best example I know is https://arrow-kt.io/learn/typed-errors/working-with-typed-errors/
๐Ÿ‘€ 1
plus1 1
๐Ÿ’ฏ 1