Exception handling in Kotlin doesn't seem effective

OK, thanks everyone for your help. While trying to generate a snippet that reliably generates the error, I realized that the next step (a transaction) was the one actually throwing the exception. I had hoped that attempting to connect to a database that didn’t exist would generate an error and I could use that branch to skip the transaction section and move on to an error screen. It turns out that exposed is perfectly OK with connecting to nonexistent databases, but tosses the exception when attempting transactions on them.

Placing my try catch block around the transaction instead has resolved the issue.

Thanks again everyone for your help.