FastCGI
This commit is contained in:
55
cli/src/Exception/Client/FastCGI.php
Normal file
55
cli/src/Exception/Client/FastCGI.php
Normal 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();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user