mirror of
https://github.com/koel/koel
synced 2024-12-23 02:53:20 +00:00
22 lines
528 B
PHP
22 lines
528 B
PHP
<?php
|
|
|
|
namespace App\Exceptions;
|
|
|
|
use Exception;
|
|
use GuzzleHttp\Exception\ClientException;
|
|
use Throwable;
|
|
|
|
class FailedToActivateLicenseException extends Exception
|
|
{
|
|
public static function fromThrowable(Throwable $e): self
|
|
{
|
|
return new static($e->getMessage(), $e->getCode(), $e);
|
|
}
|
|
|
|
public static function fromClientException(ClientException $e): self
|
|
{
|
|
$response = $e->getResponse();
|
|
|
|
return new static(json_decode($response->getBody())->error, $response->getStatusCode());
|
|
}
|
|
}
|