<?php namespace Misuzu\Whoops; use Throwable; use Sentry\EventId; use Whoops\Handler\PlainTextHandler; class SentryPlainTextHandler extends PlainTextHandler { #[\Override] public function generateResponse() { $throwable = $this->getException(); $eventId = $throwable instanceof Throwable ? \Sentry\captureException($throwable) : null; $message = $eventId instanceof EventId ? sprintf('Error has been reported: %s', (string)$eventId) : 'Error could not be reported.'; return parent::generateResponse() . $message . "\n"; } }