day-12.mjs

January 5, 2022 ยท View on GitHub

/////////////////////////////////////////////////////////////////////////////// // Day 12 - You say goodbye, I say hello // // #region problem // /////////////////////////////////////////////////////////////////////////////// // Write a try {} catch (e) {} finally {} that executes the try, but never // // finishes the try {} block, does not execute the catch {} block, and does // // execute the finally block. // ///////////////////////////////////////////////////////////////////////////////

// ... try { // ... process.exit(1); } catch (_) { process.exit(1); } finally { process.exit(0); } // ...

/////////////////////////////////////////////////////////////////////////////// // #endregion problem // ///////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////// // Test - Leave code after this alone // // #region test // ///////////////////////////////////////////////////////////////////////////////

// N/A

/////////////////////////////////////////////////////////////////////////////// // #endregion test // ///////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////// // Hints - Encoded in ROT13 encoded // // #region hints // /////////////////////////////////////////////////////////////////////////////// // // // Fvzcyr: trarengbef. // // // /////////////////////////////////////////////////////////////////////////////// // #endregion hints // ///////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////// // Use Cases // // #region uses // /////////////////////////////////////////////////////////////////////////////// // // // This workflow is something to be aware of as it is a hazard if you expect // // finally to always run after a try {} block fully completes. // // // /////////////////////////////////////////////////////////////////////////////// // #endregion uses // ///////////////////////////////////////////////////////////////////////////////