mirror of
https://github.com/bitinflow/bunny-cli.git
synced 2026-03-15 14:45:53 +00:00
Improve caching, performance and add dry-run
This commit is contained in:
13
app/Bunny/Filesystem/Exceptions/FileNotFoundException.php
Normal file
13
app/Bunny/Filesystem/Exceptions/FileNotFoundException.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Bunny\Filesystem\Exceptions;
|
||||
|
||||
use App\Bunny\Filesystem\File;
|
||||
|
||||
class FileNotFoundException extends FilesystemException
|
||||
{
|
||||
public static function fromFile(File $file): self
|
||||
{
|
||||
return new self(sprintf('The file %s was not found.', $file->getFilename()));
|
||||
}
|
||||
}
|
||||
22
app/Bunny/Filesystem/Exceptions/FilesystemException.php
Normal file
22
app/Bunny/Filesystem/Exceptions/FilesystemException.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Bunny\Filesystem\Exceptions;
|
||||
|
||||
use Exception;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
class FilesystemException extends Exception
|
||||
{
|
||||
public static function fromResponse(ResponseInterface $response): self
|
||||
{
|
||||
return new self(sprintf(
|
||||
'The storage api returns %s which is an invalid status code.',
|
||||
$response->getStatusCode()
|
||||
));
|
||||
}
|
||||
|
||||
public static function fromPrevious(Exception $exception): self
|
||||
{
|
||||
return new self($exception->getMessage(), 0, $exception);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user