Skip to content

Commit 190bd57

Browse files
committed
Store danger tag when storing exception.
1 parent b84bb85 commit 190bd57

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/Models/ExceptionLog.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ class ExceptionLog extends Model
3333
use WithUuid;
3434
use WithCreator;
3535

36+
public const TAG_DANGER = 'danger';
37+
public const TAG_INFO = 'info';
38+
3639
protected $table = 'exception_logs';
3740

3841
protected $primaryKey = 'uuid';
@@ -74,6 +77,7 @@ public static function makeFromException(Throwable $throwable, JsonSerializable
7477
'exception' => $throwable->__toString(),
7578
'previous' => (string) $throwable->getPrevious(),
7679
'payload' => optional($payload)->jsonSerialize(),
80+
'tags' => static::TAG_DANGER,
7781
]);
7882
}
7983

tests/Helpers/SlackHelperTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ public function test_slack_helper_can_send_throwable_to_slack()
4242

4343
$this->assertDatabaseCount('exception_logs', 1);
4444

45+
$this->assertDatabaseHas('exception_logs', [
46+
'tags' => 'danger',
47+
]);
48+
4549
$uuid = ExceptionLog::latest()->first()->uuid;
4650

4751
Notification::assertSentTo(new AnonymousNotifiable, DevNotification::class, function (DevNotification $class) use ($uuid) {

0 commit comments

Comments
 (0)