|null $body */ public function __construct( string $message, public readonly int $statusCode, ?Throwable $previous = null, public readonly ?array $body = null, ) { parent::__construct($message, $statusCode, $previous); } public function reason(): ?string { $reason = $this->body['reason'] ?? null; return is_string($reason) && $reason !== '' ? $reason : null; } /** * @return array|null */ public function validationErrors(): ?array { $errors = $this->body['validation_errors'] ?? $this->body['errors'] ?? null; return is_array($errors) ? $errors : null; } public function exitCode(): int { return ExitCode::fromHttpStatus($this->statusCode); } }