Closed schuma7 closed 5 years ago
I added an express middleware that creates a uuid for every incoming request so that I can easily correlate logs belonging to a single service call.
When adding this code to one of the service classes in order to generate an unhandled promise rejection:
new Promise((res, rej) => { rej(new Error('some rejection')); });
it seems as if the process.on('unhandledRejection', ...) handler does not have access to the context.
process.on('unhandledRejection', ...)
Is this expected behaviour or a bug in the library?
This is expected since the event unhandledRejection is not called in the context of a promise rejection and doesn't have its context in the continuation-local-storage.
I added an express middleware that creates a uuid for every incoming request so that I can easily correlate logs belonging to a single service call.
When adding this code to one of the service classes in order to generate an unhandled promise rejection:
it seems as if the
process.on('unhandledRejection', ...)
handler does not have access to the context.Is this expected behaviour or a bug in the library?