Sunday, 7 May 2017

how to find which promises is unhandled in nodejs UnhandledPromiseRejectionWarning?

nodejs from version 7 has async await sintactic sugar for handling promises, in my apis the following warning comes up quite often:

(node:11057) UnhandledPromiseRejectionWarning: Unhandled promise 
rejection (rejection id: 1): ReferenceError: Error: Can't set headers 
after they are sent.
(node:11057) DeprecationWarning: Unhandled promise rejections are 
deprecated. In the future, promise rejections that are not handled 
will terminate the Node.js process with a non-zero exit code.

unfortunately THERE'S NO REFERENCE TO THE LINE WHERE THE CATCH IS MISSING! is there any way to find it without checking every try catch block???



via user1658162

No comments:

Post a Comment