From 5bc870dc2d98e4749d92ff3e98e8aed9abacbecb Mon Sep 17 00:00:00 2001 From: Mauricio Siu Date: Thu, 7 May 2026 13:36:30 -0600 Subject: [PATCH] fix(hostinger): add error handling to getHostingerDataCenters function - Wrapped the API call in a try/catch block to log errors when fetching data centers. - Reformatted the OFFERED_PLAN_IDS array for improved readability. This update enhances the robustness of the Hostinger data center retrieval process. --- packages/server/src/utils/hostinger.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/packages/server/src/utils/hostinger.ts b/packages/server/src/utils/hostinger.ts index b649c9407..b30e6bbe3 100644 --- a/packages/server/src/utils/hostinger.ts +++ b/packages/server/src/utils/hostinger.ts @@ -29,9 +29,13 @@ function getVmApi() { } export async function getHostingerDataCenters() { - const api = new VPSDataCentersApi(getConfig()); - const res = await api.getDataCenterListV1(); - return res.data; + try { + const api = new VPSDataCentersApi(getConfig()); + const res = await api.getDataCenterListV1(); + return res.data; + } catch (error) { + console.log(error); + } } export async function getHostingerVpsCatalog() { @@ -86,7 +90,12 @@ export interface ManagedServerPlan { } /** KVM plan IDs offered through Dokploy (excludes Game Panel plans) */ -const OFFERED_PLAN_IDS = ["hostingercom-vps-kvm1", "hostingercom-vps-kvm2", "hostingercom-vps-kvm4", "hostingercom-vps-kvm8"]; +const OFFERED_PLAN_IDS = [ + "hostingercom-vps-kvm1", + "hostingercom-vps-kvm2", + "hostingercom-vps-kvm4", + "hostingercom-vps-kvm8", +]; /** * Fetches live VPS plans from Hostinger catalog and applies Dokploy markup.