fix: prevent hard 500 on paypal sync failure path

This commit is contained in:
Dwindi Ramadhana
2026-02-14 22:08:32 +07:00
parent 5cc626ee0c
commit 0e331d921d

View File

@@ -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', [