-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CKEditorError should use JSON.stringify carefully #4959
Comments
Isn't it a known issue that we "struggle" with all the time? Honestly, to be really safe, we should take care that each class should be inspected to check whether it doesn't have a circular reference, and if so, define its own From time to time problem like this appears and we (or at least I :P) look where is the circular reference. Anyway, AFAICS, this is a problem that I encountered a few times already and I thought that we all are aware of it. |
I wasn't aware of it so far. And the solution may be simpler – we iterate over the passed data's properties and write simple stringifcation for them because we need to handle the first level properties, but not further. If an object is encountered in one of those properties, it can be stringified to some |
This issue has come up a few times recently in the Trilium project - a note-taking Electron app that uses Ckeditor5 as the editing component. Example relevant issues are zadam/trilium#1427 and zadam/trilium#1490, showing the exact error message mentioned above about circular structures. What's the status on this bug? Can we do something to move this forward? |
I saw it few times already. For instance today I got a exception and after this there was a circular error:
I saw more of them past months (though not very often, that's for sure). I think that rather expecting client code to avoid circular references we could make our |
We observed just the very same issue trying to decorate a non-existing function (by accident... but nevertheless):
I agree with @mlewand, that
Possible reference: TypeError: cyclic object value - JavaScript | MDN. |
Fix (utils): Properly stringify objects containing circular references in `CKEditorError`. Closes #4959. Thanks to @marcellofuschi!
I've been looking at a strange error:
And the problem turned out to be that
CKEditorError
tries to doJSON.stringify()
on the data object (the details of the error).This fails because for the particular error which was thrown we log an instance of an object which has circ refs. If it was logged correctly I would realise what's wrong much faster, but this weird issue made me tracking a different bug.
If you'd like to see this feature implemented, add 👍 to this post.
The text was updated successfully, but these errors were encountered: