does `try-catch` actually throw the exception befo...
# getting-started
j
does
try-catch
actually throw the exception before catching it?
j
The code inside the
try
block throws an exception, and then the
catch
block is executed with the thrown exception
s
well, at least the code in the
try
block is supposed to be capable of throwing the particular exception that the
catch
block takes care of, but since unchecked exceptions doesn't have to be declared (and all exceptions in Kotlin are unchecked), I can be hard to figure out where a particular exception can be thrown. And it's also possible that after a refactoring or code change, a particular exception isn't thrown any more, but due to an overside of the dev who did the code change, the catch-block wasn't updated as well. The compiler won't complain about unneccessary catch-blocks, but IDEs should mark unused exceptions (at least IntelliJ does).