Precondition function | Use case | Exception thrown |
---|---|---|
require() | Checks user input validity | IllegalArgumentException |
check() | Checks object or variable state validity | IllegalStateException |
error() | Indicates an illegal state or condition | IllegalStateException |
Custom Exception
class MyException: Exception("My message")