Throw exception when namespace cannot be retrieved
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
namespace CloudObjects\SDK\Helpers;
|
||||
|
||||
use Exception;
|
||||
use CloudObjects\SDK\Exceptions\InvalidSDKConfigurationException;
|
||||
use CloudObjects\SDK\NodeReader, CloudObjects\SDK\ObjectRetriever;
|
||||
|
||||
/**
|
||||
@@ -39,6 +40,9 @@ class SDKLoader {
|
||||
public function init(string $sdkName, array $options = []) : mixed {
|
||||
$namespace = $this->objectRetriever->getAuthenticatingNamespaceCloudObject();
|
||||
|
||||
if (!$namespace)
|
||||
throw new InvalidSDKConfigurationException("The authenticating namespace object could not be retrieved.");
|
||||
|
||||
switch (strtolower($sdkName)) {
|
||||
case "sentry":
|
||||
// --- Sentry (https://sentry.io/) ---
|
||||
@@ -69,6 +73,9 @@ class SDKLoader {
|
||||
if (!isset($this->classes[$hashkey])) {
|
||||
$nsNode = $this->objectRetriever->getAuthenticatingNamespaceObjectNode();
|
||||
|
||||
if (!$nsNode)
|
||||
throw new InvalidSDKConfigurationException("The authenticating namespace object could not be retrieved.");
|
||||
|
||||
// --- Amazon Web Services (https://aws.amazon.com/) ---
|
||||
// has multiple classnames, so check for common superclass
|
||||
if (is_a($classname, 'Aws\AwsClient', true)) {
|
||||
|
||||
Reference in New Issue
Block a user