Webpack build for branch master: e124ada962

This commit is contained in:
Travis CI 2017-05-01 19:52:11 +00:00
parent 71ea0b0785
commit 0d0f47d8b8

View file

@ -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 {