From 1899050ceb2874112f4dc0d15bdfc27657745c58 Mon Sep 17 00:00:00 2001 From: Rafi Arrafif Date: Mon, 8 Sep 2025 22:58:05 +0700 Subject: [PATCH] :bug: (fix) handle the fetch error --- features/auth/lib/getOauthProviderList.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/features/auth/lib/getOauthProviderList.ts b/features/auth/lib/getOauthProviderList.ts index 6c154bd..40d8b9a 100644 --- a/features/auth/lib/getOauthProviderList.ts +++ b/features/auth/lib/getOauthProviderList.ts @@ -2,8 +2,12 @@ import { api } from "@/shared/api/connector"; const getOauthProviderList = async () => { - const res = await api.get(`auth/providers`); - return res.json(); + try { + const res = await api.get(`auth/providers`); + return res.json(); + } catch (error) { + throw new Error("Failed to fetch OAuth providers", { cause: error }); + } }; export default getOauthProviderList;