Skip to content
This repository has been archived by the owner on Jul 3, 2021. It is now read-only.

Commit

Permalink
Fix: Error swallowing with API requests.
Browse files Browse the repository at this point in the history
  • Loading branch information
thedark1337 committed Oct 11, 2017
1 parent 4c2c545 commit 6b44907
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,13 @@ class PlugAPI extends EventEmitter3 {
}

return sendCallback(body && body.status ? body.status : new Error("Can't connect to plug.dj"), null);
}).catch((err) => {
if (err && err.statusCode) {
return err;
}
process.nextTick(() => {
throw new Error(err);
});
});
};

Expand Down Expand Up @@ -1736,7 +1743,7 @@ class PlugAPI extends EventEmitter3 {

/**
* Get all ambassadors in the community
* @returns {Array} An array of all ambassadors in the room
* @returns {User[]} An array of all ambassadors in the room
*
* @example
* bot.getAmbassadors();
Expand All @@ -1747,7 +1754,7 @@ class PlugAPI extends EventEmitter3 {

/**
* Get users in the community that aren't DJing nor in the waitList
* @returns {Array} An array of all users that aren't DJing nor in the waitList
* @returns {User[]} An array of all users that aren't DJing nor in the waitList
*
* @example
* bot.getAudience();
Expand All @@ -1769,7 +1776,7 @@ class PlugAPI extends EventEmitter3 {

/**
* Get the DJ and users in the waitList
* @returns {Array} An array of all DJs and users in the waitList
* @returns {User[]} An array of all DJs and users in the waitList
*
* @example
* bot.getDJs();
Expand Down Expand Up @@ -3508,6 +3515,7 @@ PlugAPI.prototype.moderateLockWaitList = PlugAPI.prototype.moderateLockBooth;
* @prop {String} data.media.image A thumbnail image of the song.
* @prop {String} data.media.cid The media ID of the last played song.
* @prop {Number} data.media.duration How long the last played song was.
* @prop {Object} data.lastPlay Information about the previously played song. This includes the DJ, Score, Media.
* @prop {User} data.lastPlay.dj The last DJ that played a song.
* @prop {String} data.lastPlay.media.title The title of the last played song.
* @prop {String} data.lastPlay.media.author The author of the last played song.
Expand Down

0 comments on commit 6b44907

Please sign in to comment.