mirror of
https://github.com/koel/koel
synced 2024-11-14 00:17:13 +00:00
24 lines
597 B
PHP
24 lines
597 B
PHP
<?php
|
|
|
|
namespace App\Exceptions;
|
|
|
|
use Exception;
|
|
use Saloon\Exceptions\Request\RequestException;
|
|
use Throwable;
|
|
|
|
final class FailedToActivateLicenseException extends Exception
|
|
{
|
|
public static function fromThrowable(Throwable $e): self
|
|
{
|
|
return new self($e->getMessage(), $e->getCode(), $e);
|
|
}
|
|
|
|
public static function fromRequestException(RequestException $e): self
|
|
{
|
|
try {
|
|
return new self(object_get($e->getResponse()->object(), 'error'), $e->getStatus());
|
|
} catch (Throwable) {
|
|
return self::fromThrowable($e);
|
|
}
|
|
}
|
|
}
|