Files
MtoRagSystem/src/Shopware/StoreApiException.php

52 lines
1.1 KiB
PHP

<?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
{
if ($this->serverFailure || $this->utf8Failure) {
return true;
}
return $this->statusCode === 401 || $this->statusCode === 403;
}
}