RestError final class
Minn\RestError · public/minn/src/Minn/RestError.php · 60 lines · implements Stringable, Throwable · extends RuntimeException
A WordPress-shaped error, thrown from anywhere and rendered once by the kernel: {"code": ..., "message": ..., "data": {"status": ...}}.
Used by 65 (show)
Constants and properties
| prop | readonly string $errorCode | Promoted from the constructor. |
| prop | readonly int $status | Promoted from the constructor. |
| prop | readonly array $extra | Promoted from the constructor. |
| prop | readonly array $topLevel | Promoted from the constructor. |
| private | readonly bool $bare | Promoted from the constructor. |
Public
| new | __construct(string $errorCode, string $message, int $status, array $extra = array ( ), array $topLevel = array ( ), bool $bare = false)# |
| ||||||
| static | noRoute(): self# | The reference's 404 for a route nothing answers. | ||||||
| static | missingParams(array $params): self# | The reference's 400 for required parameters that did not arrive.
| ||||||
| static | invalidParam(string $param, string $message, string $code = 'rest_not_in_enum', mixed $data = NULL): self# | The reference's 400 for one parameter its schema refuses: the message under params, and under details with the refusal's code and data, as WP_REST_Request::has_valid_params reports it. | ||||||
| static | bare(string $code, string $message): self# | A statusless core error as REST serves it: HTTP 500 with data null. | ||||||
| method | payload(): array# | The error as the reference's JSON body: code, message, data. |
Nothing matches.