Cleaner error handling for gateway errors

This commit is contained in:
David Bomba 2024-09-06 09:40:42 +10:00
parent 0017307e39
commit 43b2bef464

View File

@ -87,8 +87,15 @@ class ProcessPayment extends Component
public function exception($e, $stopPropagation) public function exception($e, $stopPropagation)
{ {
nlog($e->getMessage()); $errors = session()->get('errors', new \Illuminate\Support\ViewErrorBag());
$bag = new \Illuminate\Support\MessageBag();
$bag->add('gateway_error', $e->getMessage());
session()->put('errors', $errors->put('default', $bag));
$invoice_id = $this->getContext()['payable_invoices'][0]['invoice_id'];
$this->redirectRoute('client.invoice.show', ['invoice' => $invoice_id]);
$stopPropagation(); $stopPropagation();
} }