Update readme file, Update composer.json file, Exception updates
Alle exceptions thrown in Response are now general AmazonError with json return string for full compability
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace gullevek\AmazonIncentives\Response;
|
||||
|
||||
use gullevek\AmazonIncentives\Exceptions\AmazonErrors;
|
||||
use gullevek\AmazonIncentives\Debug\AmazonDebug;
|
||||
|
||||
class CreateResponse
|
||||
@@ -168,7 +169,13 @@ class CreateResponse
|
||||
public function parseJsonResponse(array $json_response): self
|
||||
{
|
||||
if (!is_array($json_response)) {
|
||||
throw new \RuntimeException('Response must be a scalar value');
|
||||
throw AmazonErrors::getError(
|
||||
'FAILURE',
|
||||
'E001',
|
||||
'NonScalarValue',
|
||||
'Response must be a scalar value',
|
||||
0
|
||||
);
|
||||
}
|
||||
if (array_key_exists('gcId', $json_response)) {
|
||||
$this->id = $json_response['gcId'];
|
||||
|
||||
Reference in New Issue
Block a user