Skip to content

Exception Collector ​

Captures uncaught exceptions with full stack traces and exception chains (previous exceptions).

Exception Collector panel

What It Captures ​

FieldDescription
classException class name
messageException message
fileFile where the exception was thrown
lineLine number
codeException code
traceStack trace array
traceAsStringStack trace as formatted string

Data Schema ​

Exceptions are serialized as an array (chain from outermost to innermost):

json
[
    {
        "class": "RuntimeException",
        "message": "Something went wrong",
        "file": "/app/src/Service.php",
        "line": 42,
        "code": 0,
        "trace": [...],
        "traceAsString": "#0 /app/src/Controller.php(15): ..."
    },
    {
        "class": "InvalidArgumentException",
        "message": "Original cause",
        "file": "/app/src/Validator.php",
        "line": 88,
        "code": 0,
        "trace": [...],
        "traceAsString": "..."
    }
]

Summary (shown in debug entry list):

json
{
    "exception": {
        "class": "RuntimeException",
        "message": "Something went wrong",
        "file": "/app/src/Service.php",
        "line": 42,
        "code": 0
    }
}

Contract ​

php
use AppDevPanel\Kernel\Collector\ExceptionCollector;

$collector->collect(throwable: $exception);

How It Works ​

Framework adapters hook into the error handling pipeline to capture uncaught exceptions. The collector traverses the exception chain via getPrevious() and serializes each exception in the chain.

Debug Panel ​

  • Exception header — class name, message, and throw location
  • Chained exceptions — previous exceptions shown in a collapsible chain
  • Syntax-highlighted source code — shows the file around the throw line
  • Full stack trace — expandable with file links for IDE integration

Released under the MIT License.