I had a similar problem. What fixed the crash for me was making the exception I throw extend IOException
instead of Exception
.
Exception crashing the app:
data class NetworkError(override val message: String) : Exception(message)
Fixed exception:
data class NetworkError(override val message: String) : IOException(message)
Related answer from another question:
https://stackoverflow.com/a/66816809/1726308