Show toast and stringified error on profiles fetch failure

cgen-7f480f77a3014ba1be8c82e313219e3c
This commit is contained in:
Builder.io 2025-10-14 03:29:04 +00:00
parent ef332d2b76
commit 9d9c37d59b

View file

@ -316,13 +316,25 @@ const DevelopersDirectory = () => {
});
}, [profiles, search, realmFilter]);
const { toast } = useToast();
const refreshProfiles = async () => {
try {
setLoading(true);
const list = await aethexUserService.listProfiles(60);
setProfiles(list);
} catch (error) {
} catch (error: any) {
console.error("Failed to load profiles", error);
const msg =
(typeof error === "string" && error) ||
error?.message ||
JSON.stringify(error, Object.getOwnPropertyNames(error)) ||
"Unknown error";
toast({
variant: "destructive",
title: "Failed to load profiles",
description: msg,
});
setProfiles([]);
} finally {
setLoading(false);