From 7716380a685689fca6813e385f465ce09ae66818 Mon Sep 17 00:00:00 2001 From: JohGuentner <3506359+johguentner@users.noreply.github.com> Date: Mon, 18 Oct 2021 18:14:18 +0200 Subject: [PATCH] fix: check if last_edited_time is a string - during search of databases, property-information is fetched (but no value). In the case of last_edited_time, there is suddenly an unexpected empty array, which caused an error during search --- src/Entities/Properties/LastEditedTime.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Entities/Properties/LastEditedTime.php b/src/Entities/Properties/LastEditedTime.php index 4010ee9..f3a272c 100644 --- a/src/Entities/Properties/LastEditedTime.php +++ b/src/Entities/Properties/LastEditedTime.php @@ -5,6 +5,7 @@ use DateTime; use Exception; use FiveamCode\LaravelNotionApi\Exceptions\HandlingException; +use Throwable; /** * Class LastEditedTime @@ -20,10 +21,10 @@ protected function fillFromRaw(): void parent::fillFromRaw(); try { - if ($this->rawContent !== null) { + if (is_string($this->rawContent) && $this->rawContent !== null) { $this->content = new DateTime($this->rawContent); } - } catch (Exception $e) { + } catch (Throwable $e) { throw HandlingException::instance('The content of last_edited_time is not a valid ISO 8601 date time string.'); } }