Exception Handling

This Atom is Under Construction

Coping with errors doesn’t have a single obvious solution. The topic continues to evolve and we’ll look at multiple approaches.

Ideally, you discover errors when the Kotlin compiler analyzes your program. However, many errors cannot be detected at compile time, and must be discovered at run time. Before exceptions, failures were often quite disastrous. For example, programs written in the C language would simply crash and lose your work, providing very little meaningful information about what went wrong. Sometimes such a failure would take the operating system down.

Improved error reporting is one of the most powerful ways to increase the reliability of your code. Error reporting is especially important when creating program components for others to use. To create a robust system, each component must be robust. With consistent error reporting, components can reliably communicate problems to client code.

End of sample. See AtomicKotlin.com for full early-access book.

Previous          Next

©2018 Mindview LLC. All Rights Reserved.