ExceptionSnapshot
API reference › Debug Core › Storage › ExceptionSnapshot
Represents a captured throwable without executable state.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
__construct() | Frame arguments stay in their tagged form so a snapshot read back from disk re-serializes byte for byte; newly captured snapshots deliberately persist an empty argument list. | ExceptionSnapshot |
__toString() | Returns the original throwable text captured in the snapshot. | ExceptionSnapshot |
fromArray() static | Hydrates a throwable snapshot from decoded JSON data. | ExceptionSnapshot |
fromThrowable() static | Captures a throwable and its previous-exception chain without executable state. | ExceptionSnapshot |
getClass() | Returns the captured throwable class. | ExceptionSnapshot |
getCode() | Returns the captured throwable code. | ExceptionSnapshot |
getFile() | Returns the file where the throwable originated. | ExceptionSnapshot |
getLine() | Returns the line where the throwable originated. | ExceptionSnapshot |
getMessage() | Returns the captured throwable message. | ExceptionSnapshot |
getPrevious() | Returns the previous throwable snapshot or null. | ExceptionSnapshot |
getTrace() | Returns the trace frames with their arguments projected to plain display values. | ExceptionSnapshot |
jsonSerialize() | Returns the throwable snapshot for JSON serialization. | ExceptionSnapshot |
Method details
Section titled “Method details”__construct()
Section titled “__construct() ”public function __construct(string $class, string $message, int|string $code, string $file, int $line, list<array{namespace: string, short_class: string, class: string, type: string, function: string|null, file: string|null, line: int|null, args: PHPForge\Debug\Storage\DebugArray}> $trace, string $toString, self|null $previous)Frame arguments stay in their tagged form so a snapshot read back from disk re-serializes byte for byte; newly captured snapshots deliberately persist an empty argument list.
Parameters
| Parameter | Type | Description |
|---|---|---|
$class | string | Captured throwable class. |
$message | string | Captured throwable message. |
$code | int| | Captured throwable code. |
$file | string | File where the throwable originated. |
$line | int | Line where the throwable originated. |
$trace | list<array{namespace: string, DebugArray}> | Captured trace frames. |
$toString | string | Original throwable text. |
$previous | self| | Previous throwable snapshot or null. |
__toString()
Section titled “__toString() ”public function __toString(): stringReturns the original throwable text captured in the snapshot.
Returns
string: Original throwable text.
fromArray()
Section titled “fromArray() ”public static function fromArray(mixed $data, string $path = '$.exception'): selfHydrates a throwable snapshot from decoded JSON data.
Parameters
| Parameter | Type | Description |
|---|---|---|
$data | mixed | Decoded throwable payload. |
$path | string | Payload path used in hydration errors. |
Returns
self: Hydrated throwable snapshot.
fromThrowable()
Section titled “fromThrowable() ”public static function fromThrowable(Throwable $throwable): selfCaptures a throwable and its previous-exception chain without executable state.
Parameters
| Parameter | Type | Description |
|---|---|---|
$throwable | Throwable | Throwable to capture. |
Returns
self: Captured throwable snapshot.
getClass()
Section titled “getClass() ”public function getClass(): stringReturns the captured throwable class.
Returns
string: Captured throwable class.
getCode()
Section titled “getCode() ”public function getCode(): int|stringReturns the captured throwable code.
Returns
int|string: Captured throwable code.
getFile()
Section titled “getFile() ”public function getFile(): stringReturns the file where the throwable originated.
Returns
string: Origin file path.
getLine()
Section titled “getLine() ”public function getLine(): intReturns the line where the throwable originated.
Returns
int: Origin line number.
getMessage()
Section titled “getMessage() ”public function getMessage(): stringReturns the captured throwable message.
Returns
string: Captured throwable message.
getPrevious()
Section titled “getPrevious() ”public function getPrevious(): self|nullReturns the previous throwable snapshot or null.
Returns
self|null: Previous throwable snapshot or null.
getTrace()
Section titled “getTrace() ”public function getTrace(): list<array<string, mixed>>Returns the trace frames with their arguments projected to plain display values.
Returns
list<array<string, mixed>>: Display-safe trace frames.
jsonSerialize()
Section titled “jsonSerialize() ”public function jsonSerialize(): array<string, mixed>Returns the throwable snapshot for JSON serialization.
Returns
array<string, mixed>: Serialized throwable snapshot.