diff --git a/lib/users/getPlayerInfo.js b/lib/users/getPlayerInfo.js index 7f42fdb5..cfdffe0b 100644 --- a/lib/users/getPlayerInfo.js +++ b/lib/users/getPlayerInfo.js @@ -36,7 +36,7 @@ function getPlayerInfo (userId) { Promise.all(requests).then((promiseResponses) => { const responses = promiseResponses.map(response => response.value) const userBody = responses[0] - const failedResponse = promiseResponses.find(presponse => presponse.status === 'rejected') || responses.find(response => !response?.body || response.statusCode !== 200) + const failedResponses = promiseResponses.filter(presponse => presponse.status === 'rejected') if (userBody.isBanned) { const joinDate = new Date(userBody.created) @@ -52,8 +52,8 @@ function getPlayerInfo (userId) { isBanned, displayName }) - } else if (failedResponse) { - reject(new Error('User does not exist.')) + } else if (failedResponses) { + reject(new Error(failedResponses.map(r => r.reason).join('\n'))) } else { const responseBodies = responses.map(res => res.body ?? res) const oldNames = responses[4].map(nameObject => nameObject.name) || []