[wp-trac] [WordPress Trac] #2600: WP_Error class for returning errors

WordPress Trac wp-trac at lists.automattic.com
Sat Mar 25 21:05:07 GMT 2006


#2600: WP_Error class for returning errors
----------------------------+-----------------------------------------------
       Id:  2600            |      Status:  new                     
Component:  Administration  |    Modified:  Sat Mar 25 21:05:07 2006
 Severity:  normal          |   Milestone:  2.1                     
 Priority:  normal          |     Version:  2.1                     
    Owner:  ryan            |    Reporter:  ryan                    
----------------------------+-----------------------------------------------
 I'd like a nicer way to return errors, especially when validating forms
 and returning multiple error messages.  Let's have a WP_Error class that
 holds error codes and messages.  An is_wp_error function checks return
 values to see if they are a WP_Error.

 {{{
 function doer_of_stuff() {
   return  new WP_Error('broke', __("I've fallen and can't get up"));
 }

 $return = doer_of_stuff();
 if ( is_wp_error($return) )
    echo $return->get_error_message();
 }}}

-- 
Ticket URL: <http://trac.wordpress.org/ticket/2600>
WordPress Trac <http://wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list