v12.7.8 clean internal error handling
This commit is contained in:
11 files changed
+154
-510
No files matched your search
+5
-27
@@ -82,29 +82,14 @@ module.exports = {
|
||||
// Register inventory for user
|
||||
let newInventory = new Inventory();
|
||||
newInventory.createInventory(interaction.member.user.id, GuildDB.serverID);
|
||||
newInventory.save()
|
||||
.catch(err => {
|
||||
if (err) {
|
||||
client.error(err);
|
||||
const embed = new EmbedBuilder()
|
||||
.setDescription(`**Internal Error:**\nUh Oh D: Its not you, its me.\nThis command has crashed\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`)
|
||||
.setColor(client.config.Colors.Red)
|
||||
|
||||
return interaction.send({ embeds: [embed] });
|
||||
}
|
||||
});
|
||||
newInventory.save().catch(err => {
|
||||
if (err) return client.sendInternalError(err);
|
||||
});
|
||||
} else inventory = inventory.inventory
|
||||
|
||||
if (!client.exists(inventory.guilds[GuildDB.serverID])) {
|
||||
const success = addInventory(inventory.guilds, GuildDB.serverID, interaction.member.user.id, client);
|
||||
if (!success) {
|
||||
client.error(err);
|
||||
const embed = new EmbedBuilder()
|
||||
.setDescription(`**Internal Error:**\nUh Oh D: Its not you, its me.\nThis command has crashed\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`)
|
||||
.setColor(client.config.Colors.Red)
|
||||
|
||||
return interaction.send({ embeds: [embed] });
|
||||
}
|
||||
if (!success) return client.sendInternalError('Failed to add inventory');
|
||||
}
|
||||
|
||||
if (args[0].name == "view") {
|
||||
@@ -155,14 +140,7 @@ module.exports = {
|
||||
}
|
||||
|
||||
client.dbo.collection("inventories").updateOne(query, update, function (err, res) {
|
||||
if (err) {
|
||||
client.error(err);
|
||||
const embed = new EmbedBuilder()
|
||||
.setDescription(`**Internal Error:**\nUh Oh D: Its not you, its me.\nThis command has crashed\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`)
|
||||
.setColor(client.config.Colors.Red)
|
||||
|
||||
return interaction.send({ embeds: [embed] });
|
||||
}
|
||||
if (err) return client.sendInternalError(err);
|
||||
});
|
||||
|
||||
let successEmbed = new EmbedBuilder()
|
||||
|
||||
Reference in new issue
Block a user