Skip to content

Commit

Permalink
fix: reject promise on failure
Browse files Browse the repository at this point in the history
  • Loading branch information
pemrouz committed Dec 3, 2017
1 parent f69ea23 commit afb7ee9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ var crud = function crud(con, type) {
log('SQL', sql.grey);

con.query(sql, function (e, rows) {
if (e) return err(type, table, 'failed', e);
if (e) return err(type, table, 'failed', p.reject(e));
log(type.green.bold, table, 'done', rows.insertId ? (0, _str2.default)(rows.insertId).grey : '');
p.resolve(rows.insertId || body.id);
});
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const crud = (con, type) => (table, body) => {
log('SQL', sql.grey)

con.query(sql, (e, rows) => {
if (e) return err(type, table, 'failed', e)
if (e) return err(type, table, 'failed', p.reject(e))
log(type.green.bold, table, 'done', rows.insertId ? str(rows.insertId).grey : '')
p.resolve(rows.insertId || body.id)
})
Expand Down

0 comments on commit afb7ee9

Please sign in to comment.