Skip to content

Commit

Permalink
add option to stop discord error log
Browse files Browse the repository at this point in the history
  • Loading branch information
3x1io committed Mar 31, 2024
1 parent 8ab0cfb commit 5e95bbd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
18 changes: 10 additions & 8 deletions bootstrap/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@
->withExceptions(function (Exceptions $exceptions) {
$exceptions->renderable(\ProtoneMedia\Splade\SpladeCore::exceptionHandler($exceptions->handler));
$exceptions->reportable(function (Throwable $e) {
try {
$user = User::first();
$user->notifyDiscord(
title: "================= ERROR ================= \n".'MESSAGE: '.$e->getMessage() . ' | FILE: '.$e->getFile().' | LINE: '.$e->getLine().' | URL: ' . url()->current(),
webhook: config('services.discord.error-webhook')
);
}catch (\Exception $exception){
// do nothing
if(config('services.discord.error-webhook-active')){
try {
$user = User::first();
$user->notifyDiscord(
title: "================= ERROR ================= \n".'MESSAGE: '.$e->getMessage() . ' | FILE: '.$e->getFile().' | LINE: '.$e->getLine().' | URL: ' . url()->current(),
webhook: config('services.discord.error-webhook')
);
}catch (\Exception $exception){
// do nothing
}
}
});

Expand Down
1 change: 1 addition & 0 deletions config/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

'discord' => [
'error-webhook' => env('DISCORD_ERROR_WEBHOOK'),
'error-webhook-active' => env('DISCORD_ERROR_WEBHOOK_ACTIVE'),
'notification-webhook' => env('DISCORD_NOTIFICATION_WEBHOOK'),
'client_id' => env('DISCORD_CLIENT_ID'),
'client_secret' => env('DISCORD_CLIENT_SECRET'),
Expand Down

0 comments on commit 5e95bbd

Please sign in to comment.