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();
} catch (error: any) {
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({
title: "Profile update failed",
description:
error?.message ||
"Supabase rejected the update. Review payload and RLS policies.",
description: extractErrorMessage(error),
});
} finally {
setSavingProfile(false);