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
Do not log to console in tours js #40101
Conversation
What's the point of catching the promise error if you are doing this? Personally I think in the exception catching part we probably do want a console.log so we have some insight but we don't necessarily need to stop the script in it's entirety? (i.e. an eslint ignore is probably all we want here?). |
Console log is a developer thing and should not be used in production code. Either throw an exception or silently continue. I let @obuisard decide, but console.log should be removed. |
Thanks, Allon. |
So then we can remove the console log? |
Why? What benefit is there to silently swallowing errors? Ideally we’d have a mechanism to send them server side, but given we have nothing console is better than nothing |
What do you gain? We don't log to console in core so why should we do now an exception? |
My idea was to give a more 'readable' way to understand why a step would not reach its target during a tour. However, the Shepherd library does throw an exception nonetheless, so, this added information could be removed. Note that when a CSS selector is invalid, we do use the messaging mechanism to alert the user in the admin console and stop the tour. |
Really I do not care how you will remove it, but at the end, console.log must go away. |
But we do use console.log regularly around core. Go search for it… |
I did a search and only the build scripts are logging on node. Or where did you find an occurrence? |
There should be either an exception or a console log, the error should not be hidden. However with current changes we have to be sure the script working as intended, an Exception may break some routinee. |
The error is now ignored. Should the error be printed to Joomla.renderMessages? |
@obuisard can you look for an alternative if you want to show the error to the end user? console.log must be removed, that's why we have this linting rule in place and there is no other occurrence in the whole CMS which prints something to the browser console. |
I agree with doing nothing here. The library Shepherd will generate an error anyway. |
Thanks Allon @laoneo |
Summary of Changes
We should not log into the console in Javascript.
Testing Instructions
Open the drone JS code style check.
Actual result BEFORE applying this Pull Request
A warning is logged.
Expected result AFTER applying this Pull Request
No warning.
Link to documentations
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed