node-continuation-local-storage
node-continuation-local-storage copied to clipboard
Made sure not to overwrite original error context
This happens in the case of uncaught errors in nested contexts (which are sometimes created by Mongoose, etc). The nested context rethrows the error in its catch block after attaching itself to the error, which is then subsequently caught by the parent context. Without my change the originating context would be overwritten on the error.
This makes Namespace.prototype.fromException not very useful in such cases.
(Running the tests before and after applying my change had the same result, i.e. the same set of failures)
Needs a test and to pass the eslint checks, but aside from that this looks useful. Thanks for your time!
might need a 0 or a 1 somewhere