AdminError
Corex\Admin\Errors\AdminError · class · Core layer
One refusal, described once (spec 083, FR-004). The reason this exists rather than each call site building its own page: spec 079 left six hand-written standalone documents scattered across corex-config, and the denial copy in AdminPage drifted from what the screens actually require. One value object rendered by one presenter is what stops the pre-shell document and the screens’ own copy disagreeing about status, wording or the way back. Pure: no WordPress calls. The presenter owns escaping and translation. Seven constructor parameters exceeds the usual ceiling of four. That rule’s own remedy is “at five, introduce a record/DTO” — this is that record, and every field is one indivisible fact about a single refusal, so collapsing any of them into a nested object would only move the argument list somewhere else.
Public API
Section titled “Public API”__construct(AdminErrorKind $kind, string $title, string $message, int $status, array $actions, string $detail, string $bodyHtml)
Section titled “__construct(AdminErrorKind $kind, string $title, string $message, int $status, array $actions, string $detail, string $bodyHtml)”withBody(string $bodyHtml): self
Section titled “withBody(string $bodyHtml): self”The same error carrying a purpose-built body — the denied surface, which has a form in it.
withDetail(string $detail): self
Section titled “withDetail(string $detail): self”The same error carrying what the original caller said, verbatim.
withActions(array $actions): self
Section titled “withActions(array $actions): self”The same error offering a different set of ways forward.