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; } }