Merge pull request #195 from jonnybarnes/more-compact-slack-notifications

Show more useful info in slack messages
This commit is contained in:
Jonny Barnes 2020-08-15 21:15:29 +01:00 committed by GitHub
commit 141e992ac9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -58,6 +58,9 @@ class Handler extends ExceptionHandler
], ],
]); ]);
$exceptionName = get_class($throwable) ?? 'Unknown Exception';
$title = $exceptionName . ': ' . $throwable->getMessage();
$guzzle->post( $guzzle->post(
config('logging.slack'), config('logging.slack'),
[ [
@ -69,8 +72,8 @@ class Handler extends ExceptionHandler
'author_name' => app()->environment(), 'author_name' => app()->environment(),
'author_link' => config('app.url'), 'author_link' => config('app.url'),
'fields' => [[ 'fields' => [[
'title' => get_class($throwable) ?? 'Unknown Exception', 'title' => $title,
'value' => $throwable->getTraceAsString() ?? '', 'value' => request()->method() . ' ' . request()->fullUrl(),
]], ]],
'ts' => time(), 'ts' => time(),
]], ]],