Bug 1430022 - [WIP] Better error handling on copy command;r=
MozReview-Commit-ID: GF3R4FM91CP
--- a/devtools/server/actors/webconsole/utils.js
+++ b/devtools/server/actors/webconsole/utils.js
@@ -578,23 +578,26 @@ WebConsoleCommands._registerOriginal("co
try {
if (value instanceof Ci.nsIDOMElement) {
payload = value.outerHTML;
} else if (typeof value == "string") {
payload = value;
} else {
payload = JSON.stringify(value, null, " ");
}
+ owner.helperResult = {
+ type: "copyValueToClipboard",
+ value: payload,
+ };
} catch (ex) {
- payload = "/* " + ex + " */";
+ owner.helperResult = {
+ type: "error",
+ message: ex.toString(),
+ };
}
- owner.helperResult = {
- type: "copyValueToClipboard",
- value: payload,
- };
});
/**
* (Internal only) Add the bindings to |owner.sandbox|.
* This is intended to be used by the WebConsole actor only.
*
* @param object owner
* The owning object.