Error handling Rename
This commit is contained in:
@@ -55,17 +55,14 @@ export const setStandardName = async ({
|
||||
memberId: string;
|
||||
userId: string;
|
||||
}) => {
|
||||
return discordAxiosClient
|
||||
.post("/helper/set-standard-name", {
|
||||
try {
|
||||
await discordAxiosClient.post("/helper/set-standard-name", {
|
||||
memberId,
|
||||
userId,
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("Error removing roles from member:", error);
|
||||
return {
|
||||
error:
|
||||
((error as unknown as AxiosError).response?.data as unknown as { error: string }).error ||
|
||||
(error as unknown as AxiosError).message,
|
||||
};
|
||||
});
|
||||
} catch (error) {
|
||||
return {
|
||||
error: (error as AxiosError<{ error: string }>).response?.data.error || "Unknown error",
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user