Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(698)

Unified Diff: third_party/WebKit/Source/devtools/front_end/sdk/ConsoleModel.js

Issue 2249743006: [DevTools] Fill ExceptionDetails with more details, unify usage across protocol. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: browser test Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/sdk/ConsoleModel.js
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/ConsoleModel.js b/third_party/WebKit/Source/devtools/front_end/sdk/ConsoleModel.js
index 988743d21f06c31aa303e91d7d07bd5eb247b6eb..4a5191fc93a98f6856b201a2fbda34c657ad2d9a 100644
--- a/third_party/WebKit/Source/devtools/front_end/sdk/ConsoleModel.js
+++ b/third_party/WebKit/Source/devtools/front_end/sdk/ConsoleModel.js
@@ -498,6 +498,49 @@ WebInspector.ConsoleMessage.timestampComparator = function(a, b)
}
/**
+ * @param {!RuntimeAgent.ExceptionDetails} exceptionDetails
+ * @return {string}
+ */
+WebInspector.ConsoleMessage.simpleTextFromException = function(exceptionDetails)
+{
+ var text = exceptionDetails.text;
+ if (exceptionDetails.exception && exceptionDetails.exception.description) {
+ var description = exceptionDetails.exception.description;
+ if (description.indexOf("\n") !== -1)
+ description = description.substring(0, description.indexOf("\n"));
+ text += " " + description;
+ }
+ return text;
+}
+
+/**
+ * @param {!WebInspector.Target} target
+ * @param {!RuntimeAgent.ExceptionDetails} exceptionDetails
+ * @param {string=} messageType
+ * @param {number=} timestamp
+ * @param {string=} forceUrl
+ * @return {!WebInspector.ConsoleMessage}
+ */
+WebInspector.ConsoleMessage.fromException = function(target, exceptionDetails, messageType, timestamp, forceUrl)
+{
+ return new WebInspector.ConsoleMessage(
+ target,
+ WebInspector.ConsoleMessage.MessageSource.JS,
+ WebInspector.ConsoleMessage.MessageLevel.Error,
+ WebInspector.ConsoleMessage.simpleTextFromException(exceptionDetails),
+ messageType,
+ forceUrl || exceptionDetails.url,
+ exceptionDetails.lineNumber,
+ exceptionDetails.columnNumber,
+ undefined,
+ exceptionDetails.exception ? [WebInspector.RemoteObject.fromLocalObject(exceptionDetails.text), exceptionDetails.exception] : undefined,
+ exceptionDetails.stackTrace,
+ timestamp,
+ exceptionDetails.executionContextId,
+ exceptionDetails.scriptId);
+}
+
+/**
* @constructor
* @implements {LogAgent.Dispatcher}
* @param {!WebInspector.ConsoleModel} console

Powered by Google App Engine
This is Rietveld 408576698