BossBey File Manager
PHP:
8.2.30
OS:
Linux
User:
imagivibe
Root
/
home
/
imagivibe
/
public_html
/
app.imagivibe.com
/
vendor
/
paddlehq
/
paddle-php-sdk
/
src
/
Exceptions
📤 Upload
📝 New File
📁 New Folder
Close
Editing: ApiError.php
<?php declare(strict_types=1); namespace Paddle\SDK\Exceptions; use Psr\Http\Client\ClientExceptionInterface; class ApiError extends \Exception implements ClientExceptionInterface { /** @var array<FieldError> */ public array $fieldErrors; public int|null $retryAfter = null; final public function __construct( public string $type, public string $errorCode, public string $detail, public string $docsUrl, FieldError ...$fieldErrors, ) { $this->fieldErrors = $fieldErrors; parent::__construct($this->detail); } public static function fromErrorData(array $error, int|null $retryAfter = null): static { $apiError = new static( $error['type'], $error['code'], $error['detail'], $error['documentation_url'], ...array_map( fn (array $fieldError): FieldError => new FieldError($fieldError['field'], $fieldError['message']), $error['errors'] ?? [], ), ); $apiError->retryAfter = $retryAfter; return $apiError; } }
Save
Cancel