From 72e03a4fb6d3fea4343eb4e80eb369e40423970e Mon Sep 17 00:00:00 2001 From: Dao Lam Date: Tue, 12 Mar 2019 11:14:11 -0700 Subject: [PATCH] fix: error message when response is not 201 (#51) --- index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 5fbe63a..598b281 100644 --- a/index.js +++ b/index.js @@ -207,11 +207,15 @@ class ExecutorQueue extends Executor { } return new Promise((resolve, reject) => { - req(options, (err, response) => { + req(options, (err, response, body) => { if (!err && response.statusCode === 201) { return resolve(response); } + if (body) { + return reject(body); + } + return reject(err); }); });