Improve profile update error messaging in AdminMemberManager

cgen-4cd86006a3da4b959be72ad0be00899a
This commit is contained in:
Builder.io 2025-10-14 03:51:39 +00:00
parent 3e3ea898fb
commit b65d56f892

View file

@ -255,11 +255,19 @@ const AdminMemberManager = ({
await onRefresh(); await onRefresh();
} catch (error: any) { } catch (error: any) {
console.error("Failed to update profile", error); console.error("Failed to update profile", error);
const extractErrorMessage = (err: any) => {
if (!err) return "Supabase rejected the update. Review payload and RLS policies.";
if (typeof err === "string") return err;
if (err.message) return err.message;
try {
return JSON.stringify(err);
} catch (e) {
return String(err);
}
};
aethexToast.error({ aethexToast.error({
title: "Profile update failed", title: "Profile update failed",
description: description: extractErrorMessage(error),
error?.message ||
"Supabase rejected the update. Review payload and RLS policies.",
}); });
} finally { } finally {
setSavingProfile(false); setSavingProfile(false);