<?php ? collect($throwable->getTrace())->whereNotNull('file')->first()
: null;
fwrite(STDERR, json_encode([
'type' => 'throwable',
'class' => $throwable::class,
'code' => $throwable->getCode(),
'file' => $fallbackTrace['file'] ?? $throwable->getFile(),
'line' => $fallbackTrace['line'] ?? (int) $throwable->getLine(),
'message' => $throwable->getMessage(),
'trace' => array_slice($throwable->getTrace(), 0, 2),
])."\n");
}