Address error validation comment

This commit is contained in:
Bradley Schofield 2025-01-13 09:35:05 +09:00
parent 8f2cca5b0f
commit d54d0ea7b3
2 changed files with 7 additions and 6 deletions

View file

@ -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();

View file

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