mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-24 14:19:56 +02:00
Omit catch block errors when not needed
This commit is contained in:
@@ -30,7 +30,7 @@ module.exports = class MathCommand extends Command {
|
||||
try {
|
||||
const evaluated = math.evaluate(expression).toString();
|
||||
return msg.reply(evaluated).catch(() => msg.reply('Invalid expression.'));
|
||||
} catch (err) {
|
||||
} catch {
|
||||
return msg.reply('Invalid expression.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ module.exports = class UnitsCommand extends Command {
|
||||
try {
|
||||
const value = math.unit(amount, base).toNumber(target);
|
||||
return msg.say(`${formatNumber(amount)} ${base} is ${formatNumber(value)} ${target}.`);
|
||||
} catch (err) {
|
||||
} catch {
|
||||
return msg.say('Either an invalid unit type was provided or the unit types do not match.');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user