����JFIF��x�x����'
| Server IP : 78.140.185.180 / Your IP : 216.73.216.170 Web Server : LiteSpeed System : Linux cpanel13.v.fozzy.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : builderbox ( 1072) PHP Version : 7.3.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/thread-self/root/home/builderbox/././www/vendor/gliterd/backblaze-b2/src/ |
Upload File : |
<?php
namespace BackblazeB2;
use BackblazeB2\Exceptions\B2Exception;
use BackblazeB2\Exceptions\BadJsonException;
use BackblazeB2\Exceptions\BadValueException;
use BackblazeB2\Exceptions\BucketAlreadyExistsException;
use BackblazeB2\Exceptions\BucketNotEmptyException;
use BackblazeB2\Exceptions\FileNotPresentException;
use BackblazeB2\Exceptions\NotFoundException;
use BackblazeB2\Exceptions\UnauthorizedAccessException;
use GuzzleHttp\Psr7\Response;
class ErrorHandler
{
protected static $mappings = [
'bad_json' => BadJsonException::class,
'bad_value' => BadValueException::class,
'duplicate_bucket_name' => BucketAlreadyExistsException::class,
'not_found' => NotFoundException::class,
'file_not_present' => FileNotPresentException::class,
'cannot_delete_non_empty_bucket' => BucketNotEmptyException::class,
'unauthorized' => UnauthorizedAccessException::class,
];
/**
* @param Response $response
*
* @throws B2Exception
*/
public static function handleErrorResponse(Response $response)
{
$responseJson = json_decode($response->getBody(), true);
if (isset(self::$mappings[$responseJson['code']])) {
$exceptionClass = self::$mappings[$responseJson['code']];
} else {
// We don't have an exception mapped to this response error, throw generic exception
$exceptionClass = B2Exception::class;
}
throw new $exceptionClass('Received error from B2: '.$responseJson['message']);
}
}