[wp-hackers] Error Handling [was: Cron Improvements and Error
sam at rephrase.net
Thu Mar 9 08:25:49 GMT 2006
On 3/9/06, Robert Deaton <false.hopes at gmail.com> wrote:
> However, logging is the
> reason for having an error handler, and a generic logger has, imho,
> been something we've needed for plugin developers for a while.
It's just two ways of looking at the same thing -- binding actions to
events -- except that I think the handler part is more important than
the log-action part. This is mostly because I care less about logging
most events than (for example) giving users a pretty custom error page
to look at, displaying status messages in the admin interface etc.
> If you can't connect to your database, you have bigger problems.
> Besides, how would WP know your e-mail address on how to contact you
> and all if you can't connect to the database to begin with?
That's the point! The handler can solve my bigger problems. It could
alert me to the difficulties. It could redirect visitors to a static
version of the site. It could be linked to a script that tries to
restart mysqld. At the very least it could be logged!
That's one of the reasons why I suggested a pluggable handler a la the
object cache. It gives extreme flexibility to people who don't care
about having to edit an extra file.
There's also no reason that the default handler couldn't be
user-friendly and use $wpdb when it becomes available:
if (!empty($wpdb) && is_a($wpdb, 'wpdb')) // ...etc
> Now you're assuming everything is going to trigger an error, and that
> all things will have error codes. The database schema allows for you
> to not ever really have to remember some set of error codes, you just
> write in the error with the message you want to display and that's
Status code, then. Forget the error part. If you want to bind an event
to some specific action -- with do_action() in a plugin, for example
-- you need a code or some other kind of identifier. (Unless you're
just checking for a specific message string, and please let's not go
> And did you really have to split this off into a seperate thread? The
> whole point of the original was to get feedback on this.
Yes, because I didn't want to talk about cron. :P
More information about the wp-hackers