Skip to content

Commit 39ef8a3

Browse files
committed
feat(log): Add payload to notification
1 parent d9ab219 commit 39ef8a3

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/SlackLogging.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use GuzzleHttp\Exception\RequestException;
66
use Illuminate\Database\Eloquent\Model;
7-
use Illuminate\Foundation\Application;
87
use Illuminate\Http\UploadedFile;
98
use Illuminate\Notifications\Slack\BlockKit\Blocks\SectionBlock;
109
use Illuminate\Notifications\Slack\SlackMessage;
@@ -62,7 +61,7 @@ public function getExceptionData(\Throwable $exception): array
6261
$data['host'] = Request::server('SERVER_NAME');
6362
$data['method'] = Request::method();
6463
$data['fullUrl'] = Request::fullUrl();
65-
$data['exception'] = $exception->getMessage() ?? '-';
64+
$data['exception'] = $exception->getMessage();
6665
$data['error'] = $exception->getTraceAsString();
6766
$data['line'] = $exception->getLine();
6867
$data['file'] = $exception->getFile();
@@ -179,7 +178,7 @@ private function logError($exception): void
179178
$block->field("*Date:*\n{$date}")->markdown();
180179
})
181180
->sectionBlock(function (SectionBlock $block) use ($exception) {
182-
$payload = json_encode($exception['storage']['PARAMETERS'] ?? [], JSON_PRETTY_PRINT);
181+
$payload = json_encode(($exception['storage']['PARAMETERS'] ?? []), JSON_PRETTY_PRINT);
183182
$block->text(
184183
"*Payload*: ```{$payload}```"
185184
)->markdown();
@@ -218,7 +217,7 @@ private function createExceptionString(array $data): string
218217

219218
public function getUser(): ?array
220219
{
221-
if (function_exists('auth') && (app() instanceof Application && auth()->check())) {
220+
if (function_exists('auth') && auth()->check()) {
222221
/** @var \Illuminate\Contracts\Auth\Authenticatable $user */
223222
$user = auth()->user();
224223

0 commit comments

Comments
 (0)