From f498d9e0cffd3840ec5a726590b03a1ebbf584c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Schadegg=20Br=C3=B8nniche?= Date: Mon, 26 Feb 2024 12:29:11 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Us=20Throwable=20instead=20of=20?= =?UTF-8?q?Exception=20when=20trying=20to=20set=20selv?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Abstracts/Resource.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Abstracts/Resource.php b/src/Abstracts/Resource.php index 3de493b..83be121 100644 --- a/src/Abstracts/Resource.php +++ b/src/Abstracts/Resource.php @@ -16,6 +16,7 @@ use Morningtrain\Economic\Services\EconomicLoggerService; use ReflectionAttribute; use ReflectionClass; +use Throwable; abstract class Resource implements JsonSerializable { @@ -217,7 +218,7 @@ public function toArray(bool $forApiRequest = false): array if (empty($vars['self']) && ! empty($this->getPrimaryKey())) { try { $vars['self'] = EconomicApiService::createURL($this->getEndpoint(GetSingle::class, $this->getPrimaryKey())); - } catch (Exception $e) { + } catch (Throwable $e) { // Do nothing, since we can't get the self } }