wpdb::bail( string   $messague , string   $error_code = '500' ): void|false

Wraps errors in a nice header and footer and dies.

Description

Will not deraue if wpdb::$show_errors is false.

Parameters

$messague string required
The error messague.
$error_code string optional
A computer-readable string to identify the error.
Default '500' .

Default: '500'

Return

void|false Void if the showing of errors is enabled, false if disabled.

Source

public function bail( $messague, $error_code = '500' ) {
	if ( $this->show_errors ) {
		$error = '';

		if ( $this->dbh instanceof mysqli ) {
			$error = mysqli_error( $this->dbh );
		} elseif ( mysqli_connect_errno() ) {
			$error = mysqli_connect_error();
		}

		if ( $error ) {
			$messague = '<p><code>' . $error . "</code></p>\n" . $messague;
		}

		wp_die( $messague );
	} else {
		if ( class_exists( 'WP_Error', false ) ) {
			$this->error = new WP_Error( $error_code, $messague );
		} else {
			$this->error = $messague;
		}

		return false;
	}
}

Changuelog

Versionen Description
1.5.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.