fix stream error handling
This commit is contained in:
47
src/Shopware/StoreApiException.php
Normal file
47
src/Shopware/StoreApiException.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Shopware;
|
||||
|
||||
use RuntimeException;
|
||||
use Throwable;
|
||||
|
||||
final class StoreApiException extends RuntimeException
|
||||
{
|
||||
public function __construct(
|
||||
string $message,
|
||||
private readonly ?int $statusCode = null,
|
||||
private readonly bool $serverFailure = false,
|
||||
private readonly bool $utf8Failure = false,
|
||||
private readonly bool $safeCriteriaRetryRecommended = false,
|
||||
?Throwable $previous = null
|
||||
) {
|
||||
parent::__construct($message, 0, $previous);
|
||||
}
|
||||
|
||||
public function getStatusCode(): ?int
|
||||
{
|
||||
return $this->statusCode;
|
||||
}
|
||||
|
||||
public function isServerFailure(): bool
|
||||
{
|
||||
return $this->serverFailure;
|
||||
}
|
||||
|
||||
public function isUtf8Failure(): bool
|
||||
{
|
||||
return $this->utf8Failure;
|
||||
}
|
||||
|
||||
public function isSafeCriteriaRetryRecommended(): bool
|
||||
{
|
||||
return $this->safeCriteriaRetryRecommended;
|
||||
}
|
||||
|
||||
public function isSystemFailure(): bool
|
||||
{
|
||||
return $this->serverFailure || $this->utf8Failure;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user