WordPress at Your Fingertips
function is not described


AbstractRoute::get_route_error_response() protected WC 1.0

Get route response when something went wrong.

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

No Hooks.


\WP_Error. WP Error object.


// protected - for code of main (parent) or child class
$result = $this->get_route_error_response( $error_code, $error_message, $http_status_code, $additional_data );
$error_code(string) (required)
String based error code.
$error_message(string) (required)
User facing error message.
HTTP status.
Default: 500
Extra data (key value pairs) to expose in the error response.
Default: []

Code of AbstractRoute::get_route_error_response() WC 5.6.0

protected function get_route_error_response( $error_code, $error_message, $http_status_code = 500, $additional_data = [] ) {
	return new \WP_Error( $error_code, $error_message, array_merge( $additional_data, [ 'status' => $http_status_code ] ) );