Amazon Gift Card on Demand Incentives stand alone class
This commit is contained in:
37
src/Amazon/Exceptions/AmazonErrors.php
Normal file
37
src/Amazon/Exceptions/AmazonErrors.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Amazon\Exceptions;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
class AmazonErrors extends RuntimeException
|
||||
{
|
||||
/**
|
||||
* @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_code,
|
||||
string $error_type,
|
||||
string $message,
|
||||
string $_error_code
|
||||
): self {
|
||||
// NOTE: if xdebug.show_exception_trace is set to 1 this will print ERRORS
|
||||
return new static(
|
||||
json_encode([
|
||||
'code' => $error_code,
|
||||
'type' => $error_type,
|
||||
'message' => $message,
|
||||
// atach log data if exists
|
||||
'log_id' => \Amazon\Debug\AmazonDebug::getId(),
|
||||
'log' => \Amazon\Debug\AmazonDebug::getLog(),
|
||||
]),
|
||||
$_error_code
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// __END__
|
||||
Reference in New Issue
Block a user