From 39b99c4d78ca4247ca963db0387d67bb7bbc7453 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 30 Dec 2021 08:10:24 +1100 Subject: [PATCH] Try / Catch on delete PDF --- app/Services/Invoice/InvoiceService.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/Services/Invoice/InvoiceService.php b/app/Services/Invoice/InvoiceService.php index 6e0e59b50597..c8c913feff9a 100644 --- a/app/Services/Invoice/InvoiceService.php +++ b/app/Services/Invoice/InvoiceService.php @@ -331,12 +331,19 @@ class InvoiceService $this->invoice->invitations->each(function ($invitation){ + try{ + Storage::disk(config('filesystems.default'))->delete($this->invoice->client->invoice_filepath($invitation) . $this->invoice->numberFormatter().'.pdf'); if(Ninja::isHosted()) { Storage::disk('public')->delete($this->invoice->client->invoice_filepath($invitation) . $this->invoice->numberFormatter().'.pdf'); } + }catch(\Exception $e){ + nlog($e->getMessage()); + } + + }); return $this;