From be10b80fbf59d5ee801e1c94011ab2e54ca1cfe5 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Thu, 9 Mar 2017 20:17:15 +0200 Subject: [PATCH] Notify on queue errors --- app/Listeners/InvoiceListener.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/Listeners/InvoiceListener.php b/app/Listeners/InvoiceListener.php index 014cbe64bcd3..3888ccbda063 100644 --- a/app/Listeners/InvoiceListener.php +++ b/app/Listeners/InvoiceListener.php @@ -153,6 +153,14 @@ class InvoiceListener public function jobFailed(JobExceptionOccurred $exception) { + if ($errorEmail = env('ERROR_EMAIL')) { + \Mail::raw(print_r($exception->data, true), function ($message) use ($errorEmail) { + $message->to($errorEmail) + ->from(CONTACT_EMAIL) + ->subject('Job failed'); + }); + } + Utils::logError($exception->exception); } }