Hacker News new | ask | show | jobs
by GroSacASacs 3153 days ago
incorrect

     try {
        throw new Error("catch me !"); // force try to fail
      } catch (catchedError) {
        console.log("inside catch");
        // throw new Error("hmm");
      } finally {
        // always executed         
        console.log("inside finally");
      }
      // always executed
      console.log("after try catch finally");


the finally statement can be useful when another error is thrown inside the catch block, in which case you have more serious problems in your code