ModCMS PHP Error Module
Note, the name ModCMS has been changed to BurstCMS.
Introduction
I was writing some trigger_error (); function calls when I thought of something that could be part of ModCMS. Obviously, it would handle PHP errors. A simple error handling function is pretty useful on production-line websites that you still change the code actively to or a website that has not been thoroughly tested. The ModCMS error module would be required for any module. Here is what it would do.
Some people code user-friendly error code without considering the type of error that it might handle. For example, if there is a E_NOTICE or E_USER_NOTICE error in the code, don’t stop everything. A E_NOTICE or E_USER_NOTICE error is exactly what it sounds like, a notice. I believe that it should be used to notice the programmer. For example: I am currently writing a PHP method to one of my classes that will scan parts of the HTML document for not enough or too many closing tags. I am using an E_USER_NOTICE error to inform me when I have not enough or too many closing tags.
I believe that an E_WARNING or E_USER_WARNING error ought to be used for when something is definitely wrong, but the rest of the script(s) can continue even with the error. You might use it when something that isn’t very critical (page footer) doesn’t load.
User-Friendly Errors With the ModCMS Error Module
Errors need to be user-friendly. At the moment, because I haven’t coded the ModCMS error module yet, I just hide all errors unless I type a special GET parameter in the URL. The GET parameter is useful for debugging without having to turn on site-wide error reporting or having to move the script to a testing directory with error reporting enabled, but it doesn’t make any explanation to the user about why my website isn’t displaying properly.
I would fix that by having little alerts for even E_NOTICE errors.
E_NOTICE and E_USER_NOTICE errors
E_NOTICE and E_USER_NOTICE errors with the ModCMS error module would be displayed to the user with a red box at the top of the page telling the user that there might be some problems. The box would give no description of the error to the user and would not be too much of an annoyance.
E_WARNING and E_USER_WARNING errors
E_WARNING and E_USER_WARNING errors would either be a a larger red box to emphasize the error or (the programmer decides) a splash screen.
E_ERROR and E_USER_ERROR errors
E_ERROR and E_USER_ERROR errors are page-terminating, so they would display a user-friendly version of the default Apache 500 internal server error pages.
Developer-Friendly Errors With the ModCMS Error Module
If you’re the site developer, you need errors that explain what went wrong. It would be activated by the same sort of GET parameter that I use for my debugging, but instead of the errors being displayed all over the page, they would be displayed on the little box at the top of the screen, the splash screen, or the error page.
No related posts, but you might find these interesting
Posted in BurstCMS, Debugging, PHP, Security, Web Development |








Add New Comment
Thanks. Your comment is awaiting approval by a moderator.
Do you already have an account? Log in and claim this comment.
Add New Comment
Trackbacks
(Trackback URL)