Improve profile update error messaging in AdminMemberManager
cgen-4cd86006a3da4b959be72ad0be00899a
This commit is contained in:
parent
3e3ea898fb
commit
b65d56f892
1 changed files with 11 additions and 3 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue