Possibly unhandled rejection: {} #15516
Description
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
If a promise throws an exception, a useless error is now printed to the console instead of what went wrong: Possibly unhandled rejection: {}
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://plnkr.co or similar (template: http://plnkr.co/edit/tpl:yBpEi4).
http://plnkr.co/edit/PE1GPJSDUxRGiabjACCn
What is the expected behavior?
It should print the exception that was thrown and the stack trace
What is the motivation / use case for changing the behavior?
To help track down where/why the exception was thrown
Which versions of Angular, and which browser / OS are affected by this issue? Did this work in previous versions of Angular? Please also test with the latest stable and snapshot (https://code.angularjs.org/snapshot/) versions.
It worked before, now in 1.6.0 it gives this new error message that swallows the exception
Other information (e.g. stacktraces, related issues, suggestions how to fix)
It happens because ToDebugString calls JSON.Stringify on the exception, which returns {}. it needs to handle error objects differently.