Skip to content

Commit

Permalink
Added call-to action to open the error in Horizon
Browse files Browse the repository at this point in the history
  • Loading branch information
chinleung committed Apr 25, 2024
1 parent f4722c5 commit 84ff91b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Notification.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,19 @@ public function getEvent(): JobFailed

public function toMail($notifiable): MailMessage
{
return (new MailMessage())
return (new MailMessage)
->error()
->subject('A job failed at '.config('app.url'))
->line("Exception message: {$this->event->exception->getMessage()}")
->line("Job class: {$this->event->job->resolveName()}")
->line("Job body: {$this->event->job->getRawBody()}")
->line("Exception: {$this->event->exception->getTraceAsString()}");
->line("Exception: {$this->event->exception->getTraceAsString()}")
->action('View Error', url(config('horizon.path').'/failed/'.$this->event->job->getJobId()));
}

public function toSlack(): SlackMessage
{
return (new SlackMessage())
return (new SlackMessage)
->error()
->content('A job failed at '.config('app.url'))
->attachment(function (SlackAttachment $attachment) {
Expand Down

0 comments on commit 84ff91b

Please sign in to comment.