No stack trace provided if a rejected Promise's .done() method is called #411
Comments
How is that stack trace useful in any way o_0? |
It's the stack trace of what is running in the console, it is much more useful when it is actually running in code instead :) The |
Yeah, I understand what stack trace I'm seeing, what I don't understand is why you find it useful in this case - now if you had |
In the first case, it tells me the exact line that the rejected promise was produced. In the second case, all it gives me is the error message and a line number deep within bluebird. Here is an example of how the stack trace is useful: In a large project, if things break and all I see is an error with a line deep in bluebird, I wouldn't know where to even start looking. |
Since the |
That custom work is very helpful and essential for debugging. Without it my workflow when this happens is:
Maybe add a configurable option (or default) to log the stack trace before it throws the error from a |
I'd prefer just automatically doing it by default without even exposing configuration but I never personally use |
I agree that it should be automatic. It is important that it doesn't look like two errors were thrown though. We use |
Do you have any ideas how to make it obvious they are not two errors? Remember that the log cannot come after the error so we can't do e.g. |
Ideas (best first):
|
Awesome. Thanks a lot. Why did you opt to only output this if longStackTraces have been enabled? |
Because without it there wouldn't be any additional stack trace |
I changed the condition to |
Perfect. Thank you so much for the quick fix as always! :) |
When
Promise.reject(new Error('error'))
is ran, aPossibly unhandled Error...
is thrown in the browser with a very useful stack trace.However, when you
.done()
the promise, no useful stack trace is produced.The text was updated successfully, but these errors were encountered: