From aa5833a7517f73079b380fd15a1d977f4d93b718 Mon Sep 17 00:00:00 2001 From: Jonny Barnes Date: Sat, 15 Aug 2020 21:06:09 +0100 Subject: [PATCH 1/2] Show more useful info in slack messages --- app/Exceptions/Handler.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index e81af7e0..a5f8d5e3 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -58,6 +58,9 @@ class Handler extends ExceptionHandler ], ]); + $exceptionName = get_class($throwable) ?? 'Unknown Exception'; + $title = $exceptionName .': ' . $throwable->getMessage(); + $guzzle->post( config('logging.slack'), [ @@ -69,8 +72,8 @@ class Handler extends ExceptionHandler 'author_name' => app()->environment(), 'author_link' => config('app.url'), 'fields' => [[ - 'title' => get_class($throwable) ?? 'Unknown Exception', - 'value' => $throwable->getTraceAsString() ?? '', + 'title' => $title, + 'value' => request()->method() . ' ' . request()->fullUrl(), ]], 'ts' => time(), ]], From a25642507c88036ec262d3402796dbb73a7db1a8 Mon Sep 17 00:00:00 2001 From: Jonny Barnes Date: Sat, 15 Aug 2020 21:08:25 +0100 Subject: [PATCH 2/2] Add a space before concat operator --- app/Exceptions/Handler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index a5f8d5e3..d00054b4 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -59,7 +59,7 @@ class Handler extends ExceptionHandler ]); $exceptionName = get_class($throwable) ?? 'Unknown Exception'; - $title = $exceptionName .': ' . $throwable->getMessage(); + $title = $exceptionName . ': ' . $throwable->getMessage(); $guzzle->post( config('logging.slack'),