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

Unified Diff: Source/core/inspector/InjectedScriptSource.js

Issue 369333002: DevTools: Added error message when the command is invoked from the console with exception (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@add-evaluate-exception-details
Patch Set: Created 6 years, 5 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: Source/core/inspector/InjectedScriptSource.js
diff --git a/Source/core/inspector/InjectedScriptSource.js b/Source/core/inspector/InjectedScriptSource.js
index 4660bb19cfaf3693edd895463ba1fbb2ef81a2d3..1e52399fd564938b7c02551ee8006d7c1023fc29 100644
--- a/Source/core/inspector/InjectedScriptSource.js
+++ b/Source/core/inspector/InjectedScriptSource.js
@@ -617,7 +617,7 @@ InjectedScript.prototype = {
result: this._wrapObject(func.apply(object, resolvedArgs), objectGroup, returnByValue),
__proto__: null };
} catch (e) {
- return this._createThrownValue(e, objectGroup);
+ return this._createThrownValue(e, objectGroup, false);
}
},
@@ -670,21 +670,22 @@ InjectedScript.prototype = {
result: this._wrapObject(wrappedResult.result, objectGroup, returnByValue, generatePreview),
__proto__: null };
}
- return this._createThrownValue(wrappedResult.result, objectGroup, wrappedResult.exceptionDetails);
+ return this._createThrownValue(wrappedResult.result, objectGroup, generatePreview, wrappedResult.exceptionDetails);
},
/**
* @param {*} value
* @param {string} objectGroup
+ * @param {boolean} generatePreview
* @param {!DebuggerAgent.ExceptionDetails=} exceptionDetails
* @return {!Object}
*/
- _createThrownValue: function(value, objectGroup, exceptionDetails)
+ _createThrownValue: function(value, objectGroup, generatePreview, exceptionDetails)
{
- var remoteObject = this._wrapObject(value, objectGroup);
- try {
+ var remoteObject = this._wrapObject(value, objectGroup, false, generatePreview && !(value instanceof Error));
+ if (!remoteObject.description){
remoteObject.description = toStringDescription(value);
- } catch (e) {}
+ }
return { wasThrown: true, result: remoteObject, exceptionDetails: exceptionDetails, __proto__: null };
},
@@ -1042,6 +1043,9 @@ InjectedScript.prototype = {
}
}
+ if (obj instanceof Error && !!obj.message)
vsevik 2014/07/18 14:41:06 Let's extract this change to a separate CL.
kozyatinskiy1 2014/07/18 16:10:08 Done.
+ return className + ": " + obj.message;
+
return className;
}
}

Powered by Google App Engine
This is Rietveld 408576698