Skip to content

Commit 8f0dc81

Browse files
committed
fix: Adapt view data of sendMail to its mailable
1 parent 4ea48ec commit 8f0dc81

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/App/Traits/ExceptionNotificationHandlerTrait.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use App\Mail\ExceptionOccurred;
66
use Illuminate\Support\Facades\Log;
77
use Illuminate\Support\Facades\Mail;
8-
use Symfony\Component\ErrorHandler\ErrorRenderer\HtmlErrorRenderer;
98
use Throwable;
109

1110
trait ExceptionNotificationHandlerTrait
@@ -52,11 +51,17 @@ public function report(Throwable $e): void
5251
public function sendEmail(Throwable $exception): void
5352
{
5453
try {
55-
$hasDebugModeEnabled = app()->hasDebugModeEnabled();
56-
$renderer = new HtmlErrorRenderer($hasDebugModeEnabled);
57-
$html = $renderer->render($exception);
54+
$content = [
55+
'message' => $exception->getMessage(),
56+
'file' => $exception->getFile(),
57+
'line' => $exception->getLine(),
58+
'trace' => $exception->getTrace(),
59+
'url' => request()->url(),
60+
'body' => request()->all(),
61+
'ip' => request()->ip(),
62+
];
5863

59-
Mail::send(new ExceptionOccurred($html));
64+
Mail::send(new ExceptionOccurred($content));
6065
} catch (Throwable $exception) {
6166
Log::error($exception);
6267
}

0 commit comments

Comments
 (0)