mirror of
https://github.com/danbulant/discord.js
synced 2026-06-19 14:41:36 +00:00
Webpack build for branch master: e124ada962
This commit is contained in:
parent
71ea0b0785
commit
0d0f47d8b8
1 changed files with 3 additions and 1 deletions
|
|
@ -17211,13 +17211,15 @@ class DiscordAPIError extends Error {
|
|||
/**
|
||||
* Flattens an errors object returned from the API into an array.
|
||||
* @param {Object} obj Discord errors object
|
||||
* @param {string} [key] idklol
|
||||
* @param {string} [key] Used internally to determine key names of nested fields
|
||||
* @returns {string[]}
|
||||
*/
|
||||
static flattenErrors(obj, key = '') {
|
||||
let messages = [];
|
||||
|
||||
for (const k of Object.keys(obj)) {
|
||||
const newKey = key ? isNaN(k) ? `${key}.${k}` : `${key}[${k}]` : k;
|
||||
|
||||
if (obj[k]._errors) {
|
||||
messages.push(`${newKey}: ${obj[k]._errors.map(e => e.message).join(' ')}`);
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in a new issue