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