From d54d0ea7b3b93854b3fec7880ee134db80129ca5 Mon Sep 17 00:00:00 2001 From: Bradley Schofield Date: Mon, 13 Jan 2025 09:35:05 +0900 Subject: [PATCH] Address error validation comment --- app/http.php | 6 +++++- src/Appwrite/SDK/Method.php | 7 ++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/http.php b/app/http.php index 42a9010482..1ef4dcd282 100644 --- a/app/http.php +++ b/app/http.php @@ -336,5 +336,9 @@ $http->on('request', function (SwooleRequest $swooleRequest, SwooleResponse $swo } }); -Method::finaliseInitialization(); +// Check for any errors found while we were initialising the SDK Methods. +if (!empty(Method::getErrors())) { + throw new \Exception('Errors found during SDK initialization:' . PHP_EOL . implode(PHP_EOL, Method::getErrors())); +} + $http->start(); diff --git a/src/Appwrite/SDK/Method.php b/src/Appwrite/SDK/Method.php index 5032c6df53..ffcafb984b 100644 --- a/src/Appwrite/SDK/Method.php +++ b/src/Appwrite/SDK/Method.php @@ -309,11 +309,8 @@ class Method return $this; } - // Throw any errors that were found during initialization - public static function finaliseInitialization(): void + public static function getErrors(): array { - if (!empty(self::$errors)) { - throw new \Exception('Errors found during SDK initialization:' . PHP_EOL . implode(PHP_EOL, self::$errors)); - } + return self::$errors; } }