JSON encode and decode throwables and exceptions
MIT License
Bot releases are visible (Hide)
Final minor release supporting PHP 8.1 and lower, includes widening of several support packages to new major versions.
Published by github-actions[bot] almost 4 years ago
The release adds PHP 8 support!
Published by github-actions[bot] over 4 years ago
This release comes with support for including additional properties from the throwable into the encoded version of the throwable using the AdditionalPropertiesInterface
. As this is a BC break on the (return) type hint of the encoded throwable, this feature requires a new major release.
<?php
declare(strict_types=1);
use WyriHaximus\AdditionalPropertiesInterface;
use WyriHaximusxposeTraceTrait;
final class AdditionalPropertiesException extends Exception implements AdditionalPropertiesInterface
{
use ExposeTraceTrait;
private int $time;
public function __construct(int $time)
{
parent::__construct('Additional properties exception raised');
$this->time = $time;
}
public function time(): int
{
return $this->time;
}
/**
* @return array<string>
*/
public function additionalProperties(): array
{
return ['time'];
}
}
Published by github-actions[bot] over 4 years ago
This package now includes a trait for easy access to the trace from the original throwable, note that arguments of each item in the trace have been dropped to be able to serialize it. You can use the trait the following way, and access the original trace through getOriginalTrace()
:
<?php
declare(strict_types=1);
use WyriHaximusxposeTraceTrait;
final class ExposeTraceException extends Exception
{
use ExposeTraceTrait;
}
24: Drop unnecessary typechecks thanks to @WyriHaximus
23: Github config thanks to @WyriHaximus
Published by WyriHaximus over 4 years ago
Published by WyriHaximus over 6 years ago
Published by WyriHaximus over 6 years ago
Published by WyriHaximus over 6 years ago
Published by WyriHaximus over 6 years ago
Published by WyriHaximus over 6 years ago
Published by WyriHaximus over 6 years ago