[wp-hackers] Convention on dieing from functions.

Robert Deaton false.hopes at gmail.com
Wed Aug 9 07:44:48 GMT 2006

With a lot of the changes in trunk, wp_die() is becoming a nice new
way to lazy out of checking for error return values from a function by
simply dieing from inside the function. This raises a new issue for
plugin developers, as some of the functions that die out might
otherwise be useful to them. One instance is write_post(), which could
be a great function for plugins that need to insert a post into the
database without doing all the tedious error checking again
themselves. Unfortunately, for plugins that can't just let the script
die with the wp_die message on them while they're trying to insert the
post, its no longer usable.

I'm sure this isn't the only example, and so my question for hackers
is, should we establish a convention now for:
-Dieing out of functions due to errors
-How to return errors from functions

--Robert Deaton

More information about the wp-hackers mailing list