From 17d90c02915e782328e59882d507932e05332aeb Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 26 Oct 2022 13:27:04 +1100 Subject: [PATCH] Bank Transactions --- app/Jobs/Mail/NinjaMailerJob.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/Jobs/Mail/NinjaMailerJob.php b/app/Jobs/Mail/NinjaMailerJob.php index a04e9dbcd950..1b6d50cd902c 100644 --- a/app/Jobs/Mail/NinjaMailerJob.php +++ b/app/Jobs/Mail/NinjaMailerJob.php @@ -128,12 +128,19 @@ class NinjaMailerJob implements ShouldQueue /* Count the amount of emails sent across all the users accounts */ Cache::increment($this->company->account->key); - } catch (\Exception | \RuntimeException $e) { + } catch (\Exception | \RuntimeException | \Google\Service\Exception $e) { nlog("error failed with {$e->getMessage()}"); $message = $e->getMessage(); + if($e instanceof \Google\Service\Exception){ + + if(($e->getCode() == 429) && ($this->nmo->to_user instanceof ClientContact)) + $this->logMailError("Google rate limiter hit, we will retry in 30 seconds.", $this->nmo->to_user->client); + + } + /** * Post mark buries the proper message in a a guzzle response * this merges a text string with a json object