Skip to content

Commit

Permalink
Handing promise rejections from GuildAuditLogs#build to the user (#1474)
Browse files Browse the repository at this point in the history
* handing guildauditlog's promise rejections to the user

* Returning a new Promise to resolve a Promise.all is unnecessary.
Also for the docs, it returns a Promise<GuildauditLogs>, not GuildAuditLogs directly.

* totally did not removed that line
  • Loading branch information
SpaceEEC authored and iCrawl committed May 8, 2017
1 parent 6566c0d commit f95f18b
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/structures/GuildAuditLogs.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,11 @@ class GuildAuditLogs {

/**
* Handles possible promises for entry targets.
* @returns {GuildAuditLogs}
* @returns {Promise<GuildAuditLogs>}
*/
static build(...args) {
return new Promise(resolve => {
const logs = new GuildAuditLogs(...args);
Promise.all(logs.entries.map(e => e.target)).then(() => resolve(logs));
});
const logs = new GuildAuditLogs(...args);
return Promise.all(logs.entries.map(e => e.target)).then(() => logs);
}

/**
Expand Down

0 comments on commit f95f18b

Please sign in to comment.