Oracle Magazine, Nov/Dec 2017
Database Developer OPEN SOURCE return woohoo then function value console log Cool we can simulate try catch finally console log value If you run this script with Node js or in a browser you should see output similar to the following I used Node js here ORACLE MAGAZINE NOVEMBER OCTOBER 2017 52 Got a value 42 Caught the error without standard try catch Error Error on the main thread Cool we can simulate try catch finally woohoo As you can see errors thrown and values returned are routed to the next appropriate handler in the chain This fact allows Node js developers to simulate a try catch finally block Things get more interesting when the value returned is a promise When this happens the next handler in the chain will not be invoked until that promise is resolved or rejected Heres an example function getRandomNumber
You must have JavaScript enabled to view digital editions.