WooCommerce Code Reference

NotFoundException extends ApiException
in package

Thrown to signal that the requested resource doesn't exist.

Note: when the existence of a resource is itself sensitive (e.g. an order the caller has no business knowing about), prefer {@see} instead: leaking a 404 vs 401 distinction lets callers probe for resource existence.

Wire shape: extensions.code = 'NOT_FOUND', HTTP status 404.

Table of Contents

__construct()  : mixed
Constructor.
getErrorCode()  : string
Get the machine-readable error code.
getExtensions()  : array<string|int, mixed>
Get the additional error metadata.
getStatusCode()  : int
Get the HTTP status code.

Methods

__construct()

Constructor.

public __construct([string $message = 'Resource not found.' ][, array<string|int, mixed> $extensions = array() ][, Throwable|null $previous = null ]) : mixed
Parameters
$message : string = 'Resource not found.'

The error message.

$extensions : array<string|int, mixed> = array()

Additional error metadata to surface in the GraphQL extensions object.

$previous : Throwable|null = null

The previous throwable for chaining.

Return values
mixed

getErrorCode()

Get the machine-readable error code.

public getErrorCode() : string
Return values
string

getExtensions()

Get the additional error metadata.

public getExtensions() : array<string|int, mixed>
Return values
array<string|int, mixed>

getStatusCode()

Get the HTTP status code.

public getStatusCode() : int
Return values
int