WC_REST_WCCOM_Site_Installer_Controller::failure_response()
Generate a standardized response for a failed request.
Метод класса: WC_REST_WCCOM_Site_Installer_Controller{}
Хуков нет.
Возвращает
WP_REST_Response|WP_Error
.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->failure_response( $product_id, $exception );
- $product_id(int) (обязательный)
- Product ID.
- $exception(Installer_Error) (обязательный)
- The exception.
Код WC_REST_WCCOM_Site_Installer_Controller::failure_response() WC REST WCCOM Site Installer Controller::failure response WC 9.8.2
woocommerce/includes/wccom-site/rest-api/endpoints/class-wc-rest-wccom-site-installer-controller.php
protected function failure_response( $product_id, $exception ) { $state = WC_WCCOM_Site_Installation_State_Storage::get_state( $product_id ); $response = rest_ensure_response( array( 'success' => false, 'error_code' => $exception->get_error_code(), 'error_message' => $exception->get_error_message(), 'state' => $state ? $this->map_state_to_response( $state ) : null, ) ); $response->set_status( $exception->get_http_code() ); return $response; }