Skip to content
Advertisement

if (typeof data !== ‘string’) throw new error(errorMessage);

I’m working on a serverinfo command in discord.js v13 and I don’t know how to fix this error

ERROR:

[Photo Error]: https://i.stack.imgur.com/tcEem.png

if (typeof data !== ‘string’) throw new error(errorMessage); ^

RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values must be non-empty strings.

[Symbol(code)]: ‘EMBED_FIELD_VALUE’

JavaScript

Advertisement

Answer

The second parameter to .addField must be a string, as your error message says:

MessageEmbed field values must be non-empty strings.

You pass an array, which is not a “non-empty string”. I.e.

JavaScript

is fine.

JavaScript

is not.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement