mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-12-28 15:40:28 +01:00
18 lines
444 B
PHP
18 lines
444 B
PHP
|
<?php
|
||
|
|
||
|
namespace Xentral\Carrier\SendCloud;
|
||
|
|
||
|
use Exception;
|
||
|
|
||
|
class SendcloudApiException extends Exception
|
||
|
{
|
||
|
public static function fromResponse(array $response) : SendcloudApiException {
|
||
|
if (!isset($response['body']) || !is_object($response['body']))
|
||
|
return new SendcloudApiException();
|
||
|
|
||
|
return new SendcloudApiException(
|
||
|
$response['body']->error->message ?? '',
|
||
|
$response['body']->error->code ?? 0
|
||
|
);
|
||
|
}
|
||
|
}
|