2024-01-05 16:42:50 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Exceptions;
|
|
|
|
|
|
|
|
use Exception;
|
2024-01-11 16:52:55 +00:00
|
|
|
use GuzzleHttp\Exception\ClientException;
|
2024-01-05 16:42:50 +00:00
|
|
|
use Throwable;
|
|
|
|
|
|
|
|
class FailedToActivateLicenseException extends Exception
|
|
|
|
{
|
2024-01-11 16:52:55 +00:00
|
|
|
public static function fromThrowable(Throwable $e): self
|
2024-01-05 16:42:50 +00:00
|
|
|
{
|
|
|
|
return new static($e->getMessage(), $e->getCode(), $e);
|
|
|
|
}
|
2024-01-11 16:52:55 +00:00
|
|
|
|
|
|
|
public static function fromClientException(ClientException $e): self
|
|
|
|
{
|
|
|
|
$response = $e->getResponse();
|
|
|
|
|
|
|
|
return new static(json_decode($response->getBody())->error, $response->getStatusCode());
|
|
|
|
}
|
2024-01-05 16:42:50 +00:00
|
|
|
}
|