From 689937d063503dbf29189b0dbd44794a2ccc185f Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Thu, 31 Jul 2025 17:24:52 +0200 Subject: [PATCH] feat(metadata): add setter for description --- src/State/ApiResource/Error.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/State/ApiResource/Error.php b/src/State/ApiResource/Error.php index 68047e52df..dac129add8 100644 --- a/src/State/ApiResource/Error.php +++ b/src/State/ApiResource/Error.php @@ -136,6 +136,7 @@ public function __construct( ?\Throwable $previous = null, private ?array $meta = null, private ?array $source = null, + private ?string $description = null, ) { parent::__construct($title, $status, $previous); @@ -186,7 +187,12 @@ public function getSource(): ?array #[ApiProperty(writable: false, initializable: false)] public function getDescription(): ?string { - return $this->detail; + return $this->description ?? $this->detail; + } + + public function setDescription(?string $description = null): void + { + $this->description = $description; } public static function createFromException(\Exception|\Throwable $exception, int $status): self