WooCommerce Code Reference

RouteException extends Exception
in package

RouteException class.

Table of Contents

$additional_data  : array<string|int, mixed>
Additional error data.
$error_code  : string
Sanitized error code.
__construct()  : mixed
Setup exception.
getAdditionalData()  : array<string|int, mixed>
Returns additional error data.
getErrorCode()  : string
Returns the error code.

Properties

Methods

__construct()

Setup exception.

public __construct(string $error_code, string $message[, int $http_status_code = 400 ][, array<string|int, mixed> $additional_data = [] ]) : mixed
Parameters
$error_code : string

Machine-readable error code, e.g woocommerce_invalid_product_id.

$message : string

User-friendly translated error message, e.g. 'Product ID is invalid'.

$http_status_code : int = 400

Proper HTTP status code to respond with, e.g. 400.

$additional_data : array<string|int, mixed> = []

Extra data (key value pairs) to expose in the error response.

Return values
mixed