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
Asserting and debugging mechanisms #14
Comments
Uglify2 (the program we use for minification), accepts "global definitions", which can be used in the code. For example, we could have the if ( DEBUG ) {
// Debug code here
} |
This gives us something... but not too much. Actually, this gives us only what we have in v4 using the CKBuilder's comments. We need much more than that. |
I agree with @Reinmar. We need some tool which help us better debugging, but also let users give us more information about errors. If we don't want to make final code too big we can use some error codes instead of messages in the build version (end users will no debug it anyway). On the other hand I believe that we could fix some common issue by having good messages in the console. |
Maybe we could have a debugger as a separate script so have just error codes in the code, but this codes can be automatically changed into exhaustive messages if one wants to and include additional script. |
I mean, the Still the way we gonna use it is to be understood. I don't think we need a lot of debugging stuff in the distro code. Maybe just a few error codes linking to online pages with full information and just for the most critical things... the things that users will face commonly. For the dev team instead, it may be useful to have debugging code being outputted. This time not only for errors, but also for information. |
I think since we'll have MV* mechanizm me might adopt assertions and validation into models just to make it more general. I just want to say that when some value is set, then something is listening change and validate that one. Combining this with event driven approach we don't even need to add some extra code which will be available in DEV mode and removed for production versions. Simply if our |
Time for some concrete proposal. It's based on http://dev.ckeditor.com/ticket/13632 (please read the discussion). Especially comments 12 and 13. Module 'ckeditor5-core/log':
Usage example:
In a build that should be automatically replaced with:
And documentation will be automatically created for defined errors. Plus, in the build version Possible issues that I can name right now are:
Module 'ckeditor5-core/ckeditorerror'
These errors will work and be built in the same way as |
One thing that may not be clear still is when to use a |
I think we chold consider object as a second parameter:
then the minified version would be:
What would be much more useful when one put the plugin name as a module name. Note that the errors message may evolve when we refactor the code and if after refactoring we will log different parameters it may be hard to find what parameter was logged (especially for the number parameters). Additionally I am not a big fan of messages mining. We could have people complying that we have meaningless error messages and then we would need to explain how to turn full messages on. How cool it would be if you meet an error during the CKE installation and get an message which tell you not only what was wrong but also how to fix it? People really spend hours trying to install editor. Messages should be full and helpful at the begging and having minified messages should be just an option for those who complain on the editor size. |
Please read the discussion in CKE4's issue tracker.
Of course some developers will complain, but these developers always complain. I don't want to make bad decisions because of them. As for:
That wouldn't work. How do you log it then? What's
Then it's your fault if you refactored the code incorrectly ;) |
As for the minified version, I would go with json: |
My bad. I was thinking about:
But Freds idea is better. |
We may have name collisions with the |
I think that having named parameters whenever there is more then one would be very useful. Note that you may have whole console of error and need to check what parameters every error contains. |
We should have mechanisms in the dev code to:
Additional requirement is that it would be good to keep these instructions in the build mode, but at the same time we don't want to affect the code size. The idea was that we can use error codes which in the dev version will be automatically replaced by messages (loaded from separate files) and in the build mode the developer will be notified where to find the message.
Note that by logging most important events it will be easier for us to understand reported issues. The logged messages can be automatically stored and then we'll ask the developer to paste
CKEDITOR.log.dump()
result.The text was updated successfully, but these errors were encountered: