This check is necessary in order to distinguish between JavaScript and programmer-checked errors. The catch block, as its name indicates, catches all exceptions thrown in the relevant try block. The best way to do it is to verify that the exception object is of the same type we create these objects with. If the type matches, we are sure the exception is for us to handle. If the type does not match, we keep throwing the exception upward.
Exception handling is nested.
The operating system handles all exceptions that were not handled before by lower-level catch blocks. Inc. Legal Notices .