Commit 7abc5f0a authored by Alexey Kozyatinskiy's avatar Alexey Kozyatinskiy Committed by Commit Bot

Reland [DevTools] show multiline errors in DebuggerPausedMessage

Without this CL we show only first line, sometimes other lines are
important as well (see attached bug). With this CL we show message
until first call frame.

TBR=lushnikov@chromium.org

Bug: chromium:780816
Change-Id: If5e9322e8bb5b2c263c1a95e4026347db14b1b6d
Reviewed-on: https://chromium-review.googlesource.com/802076Reviewed-by: default avatarAndrey Lushnikov <lushnikov@chromium.org>
Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#521587}
Reviewed-on: https://chromium-review.googlesource.com/822131Reviewed-by: default avatarAleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#523457}
parent f174f4de
......@@ -18,6 +18,15 @@ Sources.DebuggerPausedMessage = class {
return this._element;
}
/**
* @param {string} description
*/
static _descriptionWithoutStack(description) {
var firstCallFrame = /^\s+at\s/m.exec(description);
return firstCallFrame ? description.substring(0, firstCallFrame.index - 1) :
description.substring(0, description.lastIndexOf('\n'));
}
/**
* @param {?SDK.DebuggerPausedDetails} details
* @param {!Bindings.DebuggerWorkspaceBinding} debuggerWorkspaceBinding
......@@ -47,12 +56,13 @@ Sources.DebuggerPausedMessage = class {
messageWrapper = buildWrapper(Common.UIString('Paused on XHR or fetch'), details.auxData['url'] || '');
} else if (details.reason === SDK.DebuggerModel.BreakReason.Exception) {
var description = details.auxData['description'] || details.auxData['value'] || '';
var descriptionFirstLine = description.split('\n', 1)[0];
messageWrapper = buildWrapper(Common.UIString('Paused on exception'), descriptionFirstLine, description);
var descriptionWithoutStack = Sources.DebuggerPausedMessage._descriptionWithoutStack(description);
messageWrapper = buildWrapper(Common.UIString('Paused on exception'), descriptionWithoutStack, description);
} else if (details.reason === SDK.DebuggerModel.BreakReason.PromiseRejection) {
var description = details.auxData['description'] || details.auxData['value'] || '';
var descriptionFirstLine = description.split('\n', 1)[0];
messageWrapper = buildWrapper(Common.UIString('Paused on promise rejection'), descriptionFirstLine, description);
var descriptionWithoutStack = Sources.DebuggerPausedMessage._descriptionWithoutStack(description);
messageWrapper =
buildWrapper(Common.UIString('Paused on promise rejection'), descriptionWithoutStack, description);
} else if (details.reason === SDK.DebuggerModel.BreakReason.Assert) {
messageWrapper = buildWrapper(Common.UIString('Paused on assertion'));
} else if (details.reason === SDK.DebuggerModel.BreakReason.DebugCommand) {
......
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