From 0e331d921da036aa52732651a0eaf14fc34276e9 Mon Sep 17 00:00:00 2001 From: Dwindi Ramadhana Date: Sat, 14 Feb 2026 22:08:32 +0700 Subject: [PATCH] fix: prevent hard 500 on paypal sync failure path --- .../Dashboard/AdminDashboardController.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/app/app/Http/Controllers/Dashboard/AdminDashboardController.php b/app/app/Http/Controllers/Dashboard/AdminDashboardController.php index f8148fa..1dccc4d 100644 --- a/app/app/Http/Controllers/Dashboard/AdminDashboardController.php +++ b/app/app/Http/Controllers/Dashboard/AdminDashboardController.php @@ -336,14 +336,19 @@ class AdminDashboardController extends Controller $resultSandbox = $sync->sync('sandbox'); $resultLive = $sync->sync('live'); } catch (\Throwable $e) { - report($e); - $this->logAdminAction('paypal_plan_sync_failed', [ - 'error' => $e->getMessage(), - ]); + try { + $this->logAdminAction('paypal_plan_sync_failed', [ + 'error' => $e->getMessage(), + ]); + } catch (\Throwable) { + // swallow secondary failures so sync endpoint never hard-crashes + } - return back()->withErrors([ - 'pricing' => 'PayPal sync failed. Check server logs for details (network/credentials/proxy).', - ]); + return redirect() + ->route('dashboard.admin.pricing') + ->withErrors([ + 'pricing' => 'PayPal sync failed. Check server logs for details (network/credentials/proxy).', + ]); } $this->logAdminAction('paypal_plan_sync', [