doc: more use-cases for promise events
This adds an example of a semi-common promise pattern that could result in false-positive 'unhandledRejection' events, to help motivate why there is a dual 'rejectionHandled' event. I anticipate it being helpful to users who encounter 'unhandledRejection' events that do not stem from obvious typos such as the JSON.pasre example. Also cleans up the promise rejection tracking sample. By using a Map instead of array we can get O(1) deletion and actually record the errors. And, fixed indentation and backtick usage there to align with the rest of the document. Reviewed-By:Stephan Belanger <admin@stephenbelanger.com> Reviewed-By:
Petka Antonov <petka.antonov@gmail.com> Reviewed-By:
James M Snell <jasnell@gmail.com> PR-URL: https://github.com/nodejs/node/pull/3438
parent
dc655e1d
Please register or sign in to comment