Exceptions
We'll cover the purpose and use of exceptions following this order. The one sentence summary is “Exceptions are like software interrupts—they are generated by error conditions like division by zero, and they divert the flow of control to a place where you have said you will handle this kind of error.”
First, we'll look at the basics of:
-
Why exceptions are in the language.
-
What causes an exception (implicitly and explicitly).
Once an exception has occurred, you'll want to know how to take steps to deal with it:
-
How to handle (“catch”) an exception within the method where it was thrown.
-
Handling groups of related exceptions.
You'll also need to know what happens if you do not provide code to handle each type of exception. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access