Bummer! This is just a preview. You need to be signed in with an account to view the entire instruction.

Well done!

You have completed (UPI) Chapter 11: Managing Errors, Debugging, and Handling Events in JavaScript!

Instruction

Nested Try Blocks

First, let's see what happens with this:


Example

try {
 try {
   throw new Error("oops");
 } finally {
   console.log("finally");
 }
} catch (ex) {
 console.error("outer", ex.message);
}

// Logs:
// "finally"
// "outer" "oops"

Now, if we already caught the exception in the inner try block by adding a catch block:


Example

try {...