• Home

CodingExperiments.com

CodingExperiments.com is a site where I can (obviously) experiment with various demonstrations of code.

Search

Category:

  • AJAX
  • Announcement
  • Apple-related
  • Best Practices
  • Blogger
  • Blogging
  • BurstCMS
  • Content Management System
  • Debugging
  • Experiments
  • FriendFeed
  • Gaming
  • General Code
  • Internet
  • Javascript
  • Linux
  • Microsoft
  • Microsoft Windows
  • Networks
  • Open Source
  • PHP
  • Programming Tips
  • Rant
  • Security
  • Storage
  • Twitter
  • Ubuntu
  • Uncategorized
  • Web Development
  • Windows Vista
  • WordPress

Archives:

  • November 2008
  • October 2008
  • September 2008
  • August 2008
  • July 2008
  • June 2008
  • May 2008
  • April 2008
  • March 2008
  • February 2008
  • January 2008
  • December 2007

Pages

  • About
    • The Authors
  • Commenting your code
  • How to Write Papers with Groff
  • ModCMS Anti-Spam Component Set
  • ModCMS Technical Specifications
  • Regular Expressions Guessing Game
  • Saving code directly to a web server
  • The (Almost) Perfect PHP 404 Page

Meta:

  • RSS
  • Comments RSS

Awesomeness tracker

CodingExperiments at Blogged View blog authority
Free Page Rank Tool

ModCMS PHP Error Module

February 18th, 2008 by possible248

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.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • Reddit
  • Slashdot
  • StumbleUpon
  • TwitThis

No related posts, but you might find these interesting

  • April 7, 2008 -- Some Easter Eggs for ya
  • December 6, 2007 -- Comment your code!
  • July 4, 2008 -- What Is the Correct Path for a Twitter Clone?


Posted in BurstCMS, Debugging, PHP, Security, Web Development |

discussion by DISQUS

Add New Comment

  • Subscribe:  This Thread
  • Go to:  My Comments ·  Community Page
  • Thanks. Your comment is awaiting approval by a moderator.

    Do you already have an account? Log in and claim this comment.

     
    discussion by DISQUS

    Add New Comment

    Trackbacks

    (Trackback URL)

    close ()

    status via twitter

    recent comments (follow comments)

      View Profile ยป
      Powered by Disqus · Learn more
      close Reblog this comment
      Powered by Disqus · Learn more
      blog comments powered by Disqus
      On FriendFeed, this post was liked by 1 person and commented on 0 times hide
      View this post on FriendFeed
      Liked by
      • Voyagerfan5761

      Add a comment on FriendFeed




      Logged in as [logout]

       
      Wordpress Themes by and Website Templates by Blogcut Blogged Blog Directory Blog Directory - Blogged