Final Class Yiisoft\ErrorHandler\Renderer\HeaderRenderer
| Inheritance | Yiisoft\ |
|---|---|
| Implements | Yiisoft\ |
Formats throwable into HTTP headers.
Public Methods
Method Details
| public mixed __construct ( string|null $contentType = null ) | ||
| $contentType | string|null |
The content type to be set in the response header. |
public function __construct(
private readonly ?string $contentType = null,
) {}
| public Yiisoft\ | ||
| $t | Throwable | |
| $request | ?\ |
|
public function render(Throwable $t, ?ServerRequestInterface $request = null): ErrorData
{
return new ErrorData(
'',
$this->addContentTypeHeader([
'X-Error-Message' => self::DEFAULT_ERROR_MESSAGE,
]),
);
}
| public Yiisoft\ | ||
| $t | Throwable | |
| $request | ?\ |
|
public function renderVerbose(Throwable $t, ?ServerRequestInterface $request = null): ErrorData
{
return new ErrorData(
'',
$this->addContentTypeHeader([
'X-Error-Type' => $t::class,
'X-Error-Message' => $t->getMessage(),
'X-Error-Code' => (string) $t->getCode(),
'X-Error-File' => $t->getFile(),
'X-Error-Line' => (string) $t->getLine(),
]),
);
}
User Contributed Notes
Leave a comment
Join the conversation to share a note.