Introduced common exception superclass
This commit is contained in:
1 parent
f749d4a05e
commit
afafb1ac3d
12 files changed
+48
-28
No files matched your search
@@ -14,7 +14,8 @@ use GuzzleHttp\Client, GuzzleHttp\HandlerStack, GuzzleHttp\Middleware;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
use CloudObjects\SDK\COIDParser, CloudObjects\SDK\ObjectRetriever;
|
||||
use CloudObjects\SDK\Exceptions\InvalidObjectConfigurationException,
|
||||
CloudObjects\SDK\Exceptions\CoreAPIException;
|
||||
CloudObjects\SDK\Exceptions\CoreAPIException,
|
||||
CloudObjects\SDK\Exceptions\SDKException;
|
||||
|
||||
/**
|
||||
* The APIClientFactory can be used to create a preconfigured Guzzle HTTP API client
|
||||
@@ -205,7 +206,7 @@ class APIClientFactory {
|
||||
|
||||
if ($this->reader->hasType($api, 'wa:GraphQLEndpoint')) {
|
||||
if (!class_exists('GraphQL\Client'))
|
||||
throw new Exception("Install the gmostafa/php-graphql-client package to retrieve a specific client for wa:GraphQLEndpoint objects.");
|
||||
throw new SDKException("Install the gmostafa/php-graphql-client package to retrieve a specific client for wa:GraphQLEndpoint objects.");
|
||||
|
||||
return new \GraphQL\Client($clientConfig['base_uri'],
|
||||
isset($clientConfig['headers']) ? $clientConfig['headers'] : []);
|
||||
|
||||
@@ -6,9 +6,11 @@
|
||||
|
||||
namespace CloudObjects\SDK\WebAPI\Exceptions;
|
||||
|
||||
use CloudObjects\SDK\Exceptions\SDKException;
|
||||
|
||||
/**
|
||||
* An Exception that is thrown when an an OAuth flow failed.
|
||||
*/
|
||||
class OAuthFlowException extends \Exception {
|
||||
class OAuthFlowException extends SDKException {
|
||||
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace CloudObjects\SDK\WebAPI;
|
||||
|
||||
use Exception;
|
||||
use CloudObjects\SDK\Exceptions\SDKException;
|
||||
use ML\JsonLD\Node;
|
||||
use GuzzleHttp\Client;
|
||||
use Webmozart\Assert\Assert,
|
||||
@@ -114,7 +114,7 @@ class OAuth2AuthServer {
|
||||
// no additional params needed
|
||||
break;
|
||||
default:
|
||||
throw new Exception("No flow/grant_type found.");
|
||||
throw new SDKException("No flow/grant_type found.");
|
||||
}
|
||||
|
||||
$grantCacheKey = sha1(json_encode($params));
|
||||
|
||||
Reference in new issue
Block a user