[DevTools] Report error in debug mode from promise with stack

R=vsevik@chromium.org

Review URL: https://codereview.chromium.org/645513004

git-svn-id: svn://svn.chromium.org/blink/trunk@184282 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 0b521035
...@@ -987,14 +987,27 @@ Promise.prototype.thenOrCatch = function(callback) ...@@ -987,14 +987,27 @@ Promise.prototype.thenOrCatch = function(callback)
*/ */
function reject(e) function reject(e)
{ {
console.error(e); if (e instanceof Error)
console.error(e.stack);
else
console.error(e);
callback(); callback();
} }
} }
Promise.prototype.done = function() Promise.prototype.done = function()
{ {
this.catch(console.error.bind(console)); /**
* @param {*} e
*/
function reportError(e)
{
if (e instanceof Error)
console.error(e.stack);
else
console.error(e);
}
this.catch(reportError);
} }
/** /**
......
...@@ -1749,6 +1749,6 @@ function suppressUnused(value) ...@@ -1749,6 +1749,6 @@ function suppressUnused(value)
*/ */
self.setImmediate = function(callback) self.setImmediate = function(callback)
{ {
Promise.resolve().then(callback).catch(console.error.bind(console)); Promise.resolve().then(callback).done();
return 0; return 0;
} }
...@@ -466,7 +466,7 @@ ErrorEvent.prototype.message; ...@@ -466,7 +466,7 @@ ErrorEvent.prototype.message;
window.dispatchStandaloneTestRunnerMessages; window.dispatchStandaloneTestRunnerMessages;
/** /**
* @param {function()} onCatch * @param {function(*)} onCatch
*/ */
Promise.prototype.catch = function(onCatch) {}; Promise.prototype.catch = function(onCatch) {};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment