Exception Types and Their Hierarchy
Learn how to handle common exception types and understand the exception hierarchy.
We'll cover the following
Exception types
A few types of exceptions are defined in Kotlin that we use in certain situations. Some of the most important ones are:
IllegalArgumentException
: We use this when an argument has an incorrect value. For example, when we expect our argument value to be bigger than zero but it is not.IllegalStateException
: We use this when the state of our system is incorrect. This means the values of properties are not accepted by a function call.
Get hands-on with 1400+ tech skills courses.