Copy command on cyclic object should display an error message in the console
source link: https://bugzilla.mozilla.org/show_bug.cgi?id=1430022
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Copy command on cyclic object should display an error message in the console
Categories
(DevTools :: Console, defect, P3)
Tracking
(firefox59 wontfix, firefox92 fixed)
92 Branch
People
(Reporter: nchevobbe, Assigned: claubatista)
Details
Steps to reproduce: 1. Open the webconsole 2. Evaluate the following code : `var a = {};a.b = a; copy(a);` Expected results: An error is displayed in the console, as if I was doing `var a = {};a.b = a; JSON.stringify(a);` ("TypeError: cyclic object value[Learn More]") Actual results: There is nothing displayed in the console, and when I try to paste the result of the copy command I get "/* TypeError: cyclic object value */". This is not useful because : - I don't have immediate feedback (and I may already have switched to my editor to paste the thing I wanted to copy, and thus I have to go back to the console, and figure out what is going on) - I don't have the "Learn more" link that could tell me what this error means.
Good idea, showing an error in the console would be much better than putting this on the clipboard
The patch from Comment 3 is already better than the current situation, but: - The error does not say what caused it. We should have something that say: "Error while copying object: {the actual exception}". - The error is not l10n'ed - There is no "learn more" link to make sense of the error. Also, the error is not shown if you do the copy via the context menu entry (right click on object, and select "Copy object"). We should fire the same message as if you were doing `x = {}; x.y = x;JSON.stringify(x)`, only with a prefix to indicate it is a result of the copy command.
Comment hidden (mozreview-request)
Comment on Bug 1430022 - [WIP] Better error handling on copy command; Review request updated; see interdiff: https://reviewboard.mozilla.org/r/212880/diff/1-2/
@Nicholas can you please assign me this task, I am working on it
sure! thanks
@Nicolas by Mistake I have opened another PR, please ignore that, I will update the original commit
(In reply to Abhinav Raj from comment #10)
@Nicolas by Mistake I have opened another PR, please ignore that, I will update the original commit
Please can you abandon the extra revision? If you visit it at https://phabricator.services.mozilla.com/D62046, the scroll down to the bottom. Just above the comments box, there's an Add Action option... select Abandon revision from that, then hit submit.
(In reply to Mark Banner (:standard8) from comment #11)
(In reply to Abhinav Raj from comment #10)
@Nicolas by Mistake I have opened another PR, please ignore that, I will update the original commit
Please can you abandon the extra revision? If you visit it at https://phabricator.services.mozilla.com/D62046, the scroll down to the bottom. Just above the comments box, there's an Add Action option... select Abandon revision from that, then hit submit.
(In reply to Abhinav Raj from comment #12)
(In reply to Mark Banner (:standard8) from comment #11)
(In reply to Abhinav Raj from comment #10)
@Nicolas by Mistake I have opened another PR, please ignore that, I will update the original commit
Please can you abandon the extra revision? If you visit it at https://phabricator.services.mozilla.com/D62046, the scroll down to the bottom. Just above the comments box, there's an Add Action option... select Abandon revision from that, then hit submit.
Hmm, I don't see any changes, it still looks like it is open. Did you hit submit after selecting abandon revision?
That's got it, thank you!
Abhinav, are you still working on this?
@nchevobbe I can take a look into this bug.
Thanks Alex, the bug is now yours :)
What needs to be done:
it would be nice to still pass the exception message to the client, and try to display it in the error message, but let's focus on having a message displayed first :)
Hi! I'd like to work on this. :D
thanks for helping us Claudia, the bug is now yours :)
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK