I sometimes run into seemingly random JS errors when using our CKEditor. So far, all these errors have been non-fatal and could simply be ignored by the user. If the issue that caused the error is persistant, the user can simply reload the CKEditor and everything is fine again.
What I do with the errors is send them to the server via AJAX for logging and then display them to my users. However, I was thinking would it be crazy to simply not show them to the user?
I was even concidering building a database of the most common errors and going into the CKE core and wrapping the problematic parts in try...catch, adding a severity value of -1 somewhere and re-throwing them, then ignoring all errors with that custom severity (that would still present the user with errors I haven't deemed trivial). But I don't want to hack the core.
Has anyone here heard of others doing this? How do You handle errors like that?
Such errors are mostly various undefined/null issues like when viewing in source mode
'Uncaught TypeError: Cannot call method 'setStyle' of null'
URL: ...../_source/plugins/wysiwygarea/plugin.js (line 583)
Or very rarely paste/undo issues like
'Uncaught Error: INDEX_SIZE_ERR: DOM Exception 1'
URL: ...../_source/plugins/selection/plugin.js (line 1484)
What I do with the errors is send them to the server via AJAX for logging and then display them to my users. However, I was thinking would it be crazy to simply not show them to the user?
I was even concidering building a database of the most common errors and going into the CKE core and wrapping the problematic parts in try...catch, adding a severity value of -1 somewhere and re-throwing them, then ignoring all errors with that custom severity (that would still present the user with errors I haven't deemed trivial). But I don't want to hack the core.
Has anyone here heard of others doing this? How do You handle errors like that?
Such errors are mostly various undefined/null issues like when viewing in source mode
'Uncaught TypeError: Cannot call method 'setStyle' of null'
URL: ...../_source/plugins/wysiwygarea/plugin.js (line 583)
Or very rarely paste/undo issues like
'Uncaught Error: INDEX_SIZE_ERR: DOM Exception 1'
URL: ...../_source/plugins/selection/plugin.js (line 1484)
Re: Handling non-fatal errors thrown by JavaScript
I never thought that anyone would do that, but it's clear that I was wrong.
With regards to your question, can your users do something when you show them the error message? because if they can't do anything, why are you showing it to them?
Re: Handling non-fatal errors thrown by JavaScript
This is what I'm asking about really; how have others handled errors and is there anything to learn from their experiences? If someone knows that this is a smart thing to do or indeed extremely stupid. At the moment I'm leaning towards either showing all errors or hacking the core to catch commonly seen trivial errors because if an error starts looping for an action, such as every time after pasting from Excel between a p and a div ctrl-z throws an error I need my users to see that error so I will get human reports - not just log entries.
Yes. I want to see exactly where an error has occurred so when it does I know where to check in the source - even if it's in the core. If it adds 1 or 10 seconds to the initial page load time I really don't care for now. When I start optimizing the site I will consider minifying, but not before.