<https://blog.shreyaspatil.dev/kotlin-exception-handling-why-singleton-exceptions-are-a-bad-idea>
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
👍 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