Webpack build for branch 11.1-dev: 61a081faa5

This commit is contained in:
Travis CI 2017-05-01 19:48:28 +00:00
parent f7b9cb7e60
commit 71ea0b0785

View file

@ -17150,13 +17150,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 {