diff --git a/src/structure/components/commands/moderation/Resolve.js b/src/structure/components/commands/moderation/Resolve.js index 1d988f7..6217f18 100644 --- a/src/structure/components/commands/moderation/Resolve.js +++ b/src/structure/components/commands/moderation/Resolve.js @@ -31,7 +31,7 @@ class ResolveCommand extends SlashCommand { async execute(invoker, { case: caseId, reason, notify }) { const { guild, member } = invoker; - const infraction = await new Infraction(this.client, { guild, case: caseId.value }).fetch(true);//.catch(() => null); + const infraction = await new Infraction(this.client, { guild, case: caseId.value }).fetch(true).catch(() => null); if (!infraction) return { emoji: 'failure', index: 'INFRACTION_NOT_FOUND' }; if (infraction.resolved) return { emoji: 'failure', index: 'INFRACTION_ALREADY_RESOLVED' }; diff --git a/src/structure/components/commands/moderation/Unresolve.js b/src/structure/components/commands/moderation/Unresolve.js index 49917a9..a8882a5 100644 --- a/src/structure/components/commands/moderation/Unresolve.js +++ b/src/structure/components/commands/moderation/Unresolve.js @@ -39,7 +39,7 @@ class UnresolveCommand extends SlashCommand { async execute(invoker, { case: caseId, reason, notify }) { const { guild, member } = invoker; - const infraction = await new Infraction(this.client, { guild, case: caseId.value }).fetch(true);//.catch(() => null); + const infraction = await new Infraction(this.client, { guild, case: caseId.value }).fetch(true).catch(() => null); if (!infraction) return { emoji: 'failure', index: 'INFRACTION_NOT_FOUND' }; if (!infraction.resolved) return { emoji: 'failure', index: 'INFRACTION_NOT_RESOLVED' }; diff --git a/src/structure/interfaces/Infraction.js b/src/structure/interfaces/Infraction.js index 4793e8d..c3d175d 100644 --- a/src/structure/interfaces/Infraction.js +++ b/src/structure/interfaces/Infraction.js @@ -461,7 +461,7 @@ class Infraction { */ async fetch(resolveToRightClass = false) { //Data from Mongodb (id-based data) const data = await this.client.storageManager.mongodb.infractions.findOne({ id: this.id }); - if (!data) throw new Error('No such case'); + if (!data) return Promise.reject(new Error('No such case')); if (resolveToRightClass) { const InfClass = this.client.moderationManager.infractionClasses[data.type]; const infraction = new InfClass(this.client, { fetched: true, guild: this.guild, case: this.case });