Improve errors

This commit is contained in:
Isaac 2022-10-31 21:19:29 +00:00
parent 9f18958c75
commit 14df0637ae
No known key found for this signature in database
GPG Key ID: 0DE40AE37BBA5C33
2 changed files with 14 additions and 28 deletions

View File

@ -1,7 +1,7 @@
const { Listener } = require('@eartharoid/dbf'); const { Listener } = require('@eartharoid/dbf');
const { const {
EmbedBuilder, EmbedBuilder,
inlineCode, codeBlock,
} = require('discord.js'); } = require('discord.js');
module.exports = class extends Listener { module.exports = class extends Listener {
@ -29,18 +29,6 @@ module.exports = class extends Listener {
})).locale; })).locale;
} }
const getMessage = this.client.i18n.getLocale(locale); const getMessage = this.client.i18n.getLocale(locale);
const fields = [
{
name: getMessage('misc.error.fields.identifier'),
value: inlineCode(ref),
},
];
if (error.name) {
fields.unshift({
name: getMessage('misc.error.fields.code'),
value: inlineCode(error.name),
});
}
const data = { const data = {
components: [], components: [],
embeds: [ embeds: [
@ -48,7 +36,12 @@ module.exports = class extends Listener {
.setColor('Orange') .setColor('Orange')
.setTitle(getMessage('misc.error.title')) .setTitle(getMessage('misc.error.title'))
.setDescription(getMessage('misc.error.description')) .setDescription(getMessage('misc.error.description'))
.addFields(fields), .addFields([
{
name: getMessage('misc.error.fields.identifier'),
value: codeBlock(ref),
},
]),
], ],
}; };

View File

@ -1,7 +1,7 @@
const { Listener } = require('@eartharoid/dbf'); const { Listener } = require('@eartharoid/dbf');
const { const {
EmbedBuilder, EmbedBuilder,
inlineCode, codeBlock,
} = require('discord.js'); } = require('discord.js');
module.exports = class extends Listener { module.exports = class extends Listener {
@ -29,18 +29,6 @@ module.exports = class extends Listener {
})).locale; })).locale;
} }
const getMessage = this.client.i18n.getLocale(locale); const getMessage = this.client.i18n.getLocale(locale);
const fields = [
{
name: getMessage('misc.error.fields.identifier'),
value: inlineCode(ref),
},
];
if (error.name) {
fields.unshift({
name: getMessage('misc.error.fields.code'),
value: inlineCode(error.name),
});
}
const data = { const data = {
components: [], components: [],
embeds: [ embeds: [
@ -48,7 +36,12 @@ module.exports = class extends Listener {
.setColor('Orange') .setColor('Orange')
.setTitle(getMessage('misc.error.title')) .setTitle(getMessage('misc.error.title'))
.setDescription(getMessage('misc.error.description')) .setDescription(getMessage('misc.error.description'))
.addFields(fields), .addFields([
{
name: getMessage('misc.error.fields.identifier'),
value: codeBlock(ref),
},
]),
], ],
}; };