Update error check

This commit is contained in:
Blade Barringer
2015-10-17 21:24:46 -05:00
parent 477fb8edcb
commit ab2b564a03
2 changed files with 8 additions and 2 deletions

View File

@@ -51,7 +51,13 @@ function _requestMaker(user, method) {
.query(query)
.send(send)
.end((err, response) => {
if (err) { return reject(err); }
if (err) {
let errorString = JSON.parse(err.response.text).err;
return reject({
code: err.response.statusCode,
text: errorString,
});
}
resolve(response.body);
});