Automattic\WooCommerce\StoreApi\Schemas\V1
ErrorSchema::get_item_response
Convert a WP_Error into an object suitable for the response.
Метод класса: ErrorSchema{}
Хуков нет.
Возвращает
Массив.
Использование
$ErrorSchema = new ErrorSchema(); $ErrorSchema->get_item_response( $error );
- $error(WP_Error) (обязательный)
- Error object.
Код ErrorSchema::get_item_response() ErrorSchema::get item response WC 11.0.1
public function get_item_response( $error ) {
return [
'code' => $this->prepare_html_response( $error->get_error_code() ),
'message' => $this->prepare_html_response( $error->get_error_message() ),
];
}