Commit e8d7bd37 authored by Alexey Kozyatinskiy's avatar Alexey Kozyatinskiy Committed by Commit Bot

[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.

R=lushnikov@chromium.org

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