This commit is contained in:
Juan Pablo Vial
2025-06-25 18:07:08 -04:00
parent 7f97862324
commit ab7328b40b
8 changed files with 202 additions and 20 deletions

View File

@ -0,0 +1,55 @@
<?php
namespace Incoviba\Exception\Client;
use Throwable;
use Psr\Http\Client\ClientExceptionInterface;
class FastCGI implements ClientExceptionInterface
{
public function __construct(protected ?Throwable $previous) {}
public function getMessage(): string
{
$message = "Could not send request";
if ($this->previous !== null) {
$message .= ": {$this->previous->getMessage()}";
}
return $message;
}
public function getCode()
{
return $this->previous?->getCode() ?? 500;
}
public function getFile(): string
{
return $this->previous?->getFile() ?? '';
}
public function getLine(): int
{
return $this->previous?->getLine() ?? 0;
}
public function getTrace(): array
{
return $this->previous?->getTrace() ?? [];
}
public function getTraceAsString(): string
{
return $this->previous?->getTraceAsString() ?? '';
}
public function getPrevious(): ?Throwable
{
return $this->previous;
}
public function __toString()
{
return $this->getMessage();
}
}