From b70c8bde81bb2b29fa8d08d76a830e68211e270b Mon Sep 17 00:00:00 2001 From: anandre <38661761+anandre@users.noreply.github.com> Date: Wed, 31 Mar 2021 21:23:38 -0500 Subject: [PATCH 1/3] Make MessageEmbed#normalizeField better `normalizeField` was made with a custom error to throw, this PR removes that so that a proper API error with path will be thrown instead. This makes the error message more informative. --- src/structures/MessageEmbed.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/structures/MessageEmbed.js b/src/structures/MessageEmbed.js index 8d9dce92b0aa..dbf9e2b1ffff 100644 --- a/src/structures/MessageEmbed.js +++ b/src/structures/MessageEmbed.js @@ -428,9 +428,7 @@ class MessageEmbed { */ static normalizeField(name, value, inline = false) { name = Util.resolveString(name); - if (!name) throw new RangeError('EMBED_FIELD_NAME'); value = Util.resolveString(value); - if (!value) throw new RangeError('EMBED_FIELD_VALUE'); return { name, value, inline }; } From 1e20500edcbecdffdfde147c4e00ed000a41ba36 Mon Sep 17 00:00:00 2001 From: anandre <38661761+anandre@users.noreply.github.com> Date: Mon, 10 May 2021 09:10:36 -0500 Subject: [PATCH 2/3] Remove unneeded constants Removes the constants for empty embed name/values. --- src/errors/Messages.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/errors/Messages.js b/src/errors/Messages.js index eed78f1f9aed..d0752d5d9d5d 100644 --- a/src/errors/Messages.js +++ b/src/errors/Messages.js @@ -37,9 +37,6 @@ const Messages = { COLOR_RANGE: 'Color must be within the range 0 - 16777215 (0xFFFFFF).', COLOR_CONVERT: 'Unable to convert color to a number.', - EMBED_FIELD_NAME: 'MessageEmbed field names may not be empty.', - EMBED_FIELD_VALUE: 'MessageEmbed field values may not be empty.', - FILE_NOT_FOUND: file => `File could not be found: ${file}`, USER_NO_DMCHANNEL: 'No DM Channel exists!', From b27d0c6606a4466d4ddd698e5ab3fb1ff352a1b7 Mon Sep 17 00:00:00 2001 From: anandre <38661761+anandre@users.noreply.github.com> Date: Mon, 10 May 2021 09:34:48 -0500 Subject: [PATCH 3/3] Update MessageEmbed.js --- src/structures/MessageEmbed.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/structures/MessageEmbed.js b/src/structures/MessageEmbed.js index dbf9e2b1ffff..4966d6c48725 100644 --- a/src/structures/MessageEmbed.js +++ b/src/structures/MessageEmbed.js @@ -1,6 +1,5 @@ 'use strict'; -const { RangeError } = require('../errors'); const Util = require('../util/Util'); /**