Introduced common exception superclass

This commit is contained in:
lukas committed 2026-10-15 13:39:44 +00:00
1 parent f749d4a05e
commit afafb1ac3d
12 files changed
+48 -28

No files matched your search

+8 -7
View File
@@ -23,7 +23,8 @@ use Kevinrob\GuzzleCache\Storage\CacheStorageInterface,
use Psr\Cache\CacheItemPoolInterface;
use Psr\SimpleCache\CacheInterface;
use CloudObjects\SDK\Exceptions\CoreAPIException,
CloudObjects\SDK\Exceptions\InvalidSDKConfigurationException;
CloudObjects\SDK\Exceptions\InvalidSDKConfigurationException,
CloudObjects\SDK\Exceptions\SDKException;
use CloudObjects\SDK\AccountGateway\AccountContext;
/**
@@ -241,7 +242,7 @@ class ObjectRetriever implements CustomCacheAndLogInterface {
*/
public function getObjectNode(IRI $coid) : ?Node {
if (!COIDParser::isValidCOID($coid))
throw new Exception("Not a valid COID.");
throw new SDKException("Not a valid COID.");
$uriString = (string)$coid;
@@ -308,7 +309,7 @@ class ObjectRetriever implements CustomCacheAndLogInterface {
*/
public function fetchObjectsInNamespaceWithType(IRI $namespaceCoid, $type) {
if (COIDParser::getType($namespaceCoid) != COIDParser::COID_ROOT)
throw new Exception("Not a valid namespace COID.");
throw new SDKException("Not a valid namespace COID.");
$ts = microtime(true);
$type = (string)$type;
@@ -353,7 +354,7 @@ class ObjectRetriever implements CustomCacheAndLogInterface {
*/
public function fetchAllObjectsInNamespace(IRI $namespaceCoid) {
if (COIDParser::getType($namespaceCoid) != COIDParser::COID_ROOT)
throw new Exception("Not a valid namespace COID.");
throw new SDKException("Not a valid namespace COID.");
$ts = microtime(true);
@@ -394,7 +395,7 @@ class ObjectRetriever implements CustomCacheAndLogInterface {
*/
public function getCOIDListForNamespace(IRI $namespaceCoid) {
if (COIDParser::getType($namespaceCoid) != COIDParser::COID_ROOT)
throw new Exception("Not a valid namespace COID.");
throw new SDKException("Not a valid namespace COID.");
$ts = microtime(true);
@@ -429,7 +430,7 @@ class ObjectRetriever implements CustomCacheAndLogInterface {
*/
public function getCOIDListForNamespaceWithType(IRI $namespaceCoid, $type) {
if (COIDParser::getType($namespaceCoid) != COIDParser::COID_ROOT)
throw new Exception("Not a valid namespace COID.");
throw new SDKException("Not a valid namespace COID.");
$ts = microtime(true);
$type = (string)$type;
@@ -472,7 +473,7 @@ class ObjectRetriever implements CustomCacheAndLogInterface {
if (is_object($coid) && get_class($coid)=='ML\IRI\IRI')
return $this->getObject($coid);
throw new Exception('COID must be passed as a string or an IRI object.');
throw new SDKException('COID must be passed as a string or an IRI object.');
}
/**