WooCommerce Code Reference

CacheException extends Exception
in package

Exception thrown by classes derived from ObjectCache.

Table of Contents

$cached_id  : int|string|null
The id of the cached object, if available.
$errors  : array<string|int, mixed>
Error messages.
$thrower  : ObjectCache
The object that threw the exception.
__construct()  : mixed
Creates a new instance of the class.
__toString()  : string
Get a string representation of the exception object.
get_cached_id()  : int|string|null
Gets the id of the cached object as passed to the exception constructor.
get_errors()  : array<string|int, mixed>
Gets the array of error messages passed to the exception constructor.
get_thrower()  : object
Gets the object that threw the exception as passed to the exception constructor.

Properties

Methods

__construct()

Creates a new instance of the class.

public __construct(string $message, ObjectCache $thrower[, int|string|null $cached_id = null ][, array<string|int, mixed>|null $errors = null ], mixed $code[, Throwable|null $previous = null ]) : mixed
Parameters
$message : string

The exception message.

$thrower : ObjectCache

The object that is throwing the exception.

$cached_id : int|string|null = null

The involved cached object id, if available.

$errors : array<string|int, mixed>|null = null

An array of error messages, if available.

$code : mixed

An error code, if available.

$previous : Throwable|null = null

The previous exception, if available.

Return values
mixed

__toString()

Get a string representation of the exception object.

public __toString() : string
Return values
stringString representation of the exception object.

get_cached_id()

Gets the id of the cached object as passed to the exception constructor.

public get_cached_id() : int|string|null
Return values
int|string|nullThe id of the cached object.

get_errors()

Gets the array of error messages passed to the exception constructor.

public get_errors() : array<string|int, mixed>
Return values
array<string|int, mixed>Error messages passed to the exception constructor.

get_thrower()

Gets the object that threw the exception as passed to the exception constructor.

public get_thrower() : object
Return values
objectThe object that threw the exception.