[wp-trac] [WordPress Trac] #22115: Further Simplifying errors

WordPress Trac wp-trac at lists.automattic.com
Sat Oct 6 11:32:16 UTC 2012


#22115: Further Simplifying errors
--------------------------------------+-----------------------------
 Reporter:  msolution                 |       Type:  feature request
   Status:  new                       |   Priority:  normal
Milestone:  Awaiting Review           |  Component:  Database
  Version:  3.4.2                     |   Severity:  normal
 Keywords:  2nd-opinion dev-feedback  |
--------------------------------------+-----------------------------
 tracking errors while making API's and cron jobs, is a tad difficult.

 from the latest wordpress pack, '''''/includes/wp-db.php'''''

 {{{
 function query( $query ) {
 ...
 ...
 if ( defined( 'SAVEQUERIES' ) && SAVEQUERIES )
         $this->queries[] = array( $query, $this->timer_stop(),
 $this->get_caller() );

 // If there is an error then take note of it..
 if ( $this->last_error = mysql_error( $this->dbh ) ) {
         $this->print_error();
         return false;
 }
 ...
 ...
 }}}

 if we change the above to simply

 {{{
 // If there is an error then take note of it..
 $this->last_error = '';
 if ( $this->last_error = mysql_error( $this->dbh ) )
         $this->print_error();

 if ( defined( 'SAVEQUERIES' ) && SAVEQUERIES )
         $this->queries[] = array( $query, $this->timer_stop(),
 $this->get_caller(), $this->last_error );

 // If there is an error then take note of it..
 if ( ! empty( $this->last_error ) )
         return false;
 }}}

 then we have all required info in the array queries, for use later. may it
 be wp_footer, or for a plugin as debug info.

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


More information about the wp-trac mailing list