mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-19 12:19:16 +00:00
improvement: translated all backend errors messages
This commit is contained in:
@@ -7,7 +7,7 @@ const CheckSettings = async (key: string): Promise<string> => {
|
||||
});
|
||||
|
||||
if (!setting) {
|
||||
throw new AppError("No setting found with this id.", 404);
|
||||
throw new AppError("ERR_NO_SETTING_FOUND", 404);
|
||||
}
|
||||
|
||||
return setting.value;
|
||||
|
||||
@@ -7,7 +7,7 @@ const GetDefaultWhatsApp = async (): Promise<Whatsapp> => {
|
||||
});
|
||||
|
||||
if (!defaultWhatsapp) {
|
||||
throw new AppError("ERR_NO_WAPP_FOUND");
|
||||
throw new AppError("ERR_NO_DEF_WAPP_FOUND");
|
||||
}
|
||||
|
||||
return defaultWhatsapp;
|
||||
|
||||
@@ -19,20 +19,13 @@ export const GetWbotMessage = async (
|
||||
const msgToDelete = chatMessages.find(msg => msg.id.id === messageId);
|
||||
|
||||
if (!msgToDelete) {
|
||||
throw new AppError("msgNotFound");
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
return msgToDelete;
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
if (err.message === "msgNotFound") {
|
||||
throw new AppError(
|
||||
"Could not find a message witht this ID in WhatsApp chat."
|
||||
);
|
||||
}
|
||||
throw new AppError(
|
||||
"Could not valid WhatsApp contact. Check connections page"
|
||||
);
|
||||
throw new AppError("ERR_DELETE_WAPP_MSG");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user