Section 8

Errors

throw, try, catch, finally — raising an error, catching it, and moving on.

Section 5.2 promised it: “throw ends a method as well as return does — that keyword will come in its own time.” And 6.1 had you meet a run-time error defenceless: the program fell, full stop.

Its time has come. This section teaches how to throw an error, catch it, and keep the program going — your own errors first, then the language’s.

In this section