Add README file, add status to exception return

Because status RESEND/FAILURE has to be checked we also add this to the
Exception return json string.
Also handle unset errors (eg when we get an Rate Limit error)

Move the _ENV check into mtheod

test now has some basic mock tests
This commit is contained in:
2021-10-19 09:39:14 +09:00
parent b00d545a10
commit 71abd4d06e
6 changed files with 193 additions and 37 deletions

View File

@@ -7,13 +7,15 @@ use RuntimeException;
class AmazonErrors extends RuntimeException
{
/**
* @param string $error_code errorCode from Amazon
* @param string $error_type errorType from Amazon
* @param string $error_status agcodResponse->status from Amazon
* @param string $error_code errorCode from Amazon
* @param string $error_type errorType from Amazon
* @param string $message
* @param string $_error_code
* @return AmazonErrors
*/
public static function getError(
string $error_status,
string $error_code,
string $error_type,
string $message,
@@ -22,6 +24,7 @@ class AmazonErrors extends RuntimeException
// NOTE: if xdebug.show_exception_trace is set to 1 this will print ERRORS
return new static(
json_encode([
'status' => $error_status,
'code' => $error_code,
'type' => $error_type,
'message' => $message,