Check whether variable is a WordPress Error.

Returns true if $thing is an object of the WP_Error class.

Signature

is_wp_error( $thing )
thing
 (mixed) Check if unknown variable is a WP_Error object.

Return

(boolean) True, if WP_Error. False, if not WP_Error.

Source

function is_wp_error($thing) {
	if ( is_object($thing) && is_a($thing, 'WP_Error') )
		return true;
	return false;
}
WP Trac GitHub

Link here