Opened 8 months ago

Last modified 3 days ago

#22115 new enhancement

Further Simplifying errors

Reported by: msolution Owned by:
Priority: normal Milestone: Future Release
Component: Database Version: 3.4.2
Severity: normal Keywords: 2nd-opinion dev-feedback has-patch
Cc: msolution

Description

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.

Attachments (1)

22115.patch (766 bytes) - added by SergeyBiryukov 7 months ago.

Download all attachments as: .zip

Change History (5)

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 3.6
  • Type changed from feature request to enhancement

comment:4   ryan3 days ago

  • Milestone changed from 3.6 to Future Release
Note: See TracTickets for help on using tickets.