WordPress at a glance
function is not described

Automattic\WooCommerce\Admin\API

NavigationFavorites::prepare_error() protected WC 1.0

Accept an instance of WP_Error and add the appropriate data for REST transit.

{} It's a method of the class: NavigationFavorites{}

No Hooks.

Return

WP_Error. Nothing.

Usage

// protected - for code of main (parent) or child class
$result = $this->prepare_error( $error );
$error(WP_Error) (required)
Error to prepare.

Code of NavigationFavorites::prepare_error() WC 5.3.0

<?php
protected function prepare_error( $error ) {
	if ( ! is_wp_error( $error ) ) {
		return $error;
	}

	$error->add_data(
		array(
			'status' => $this->error_to_status_map[ $error->get_error_code() ] ?? 500,
		)
	);

	return $error;
}