Skip to content

Commit

Permalink
fix: move sql to error stack (ali-sdk#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 authored and dead-horse committed Jun 2, 2016
1 parent 1e4c769 commit 54349cd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/operator.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ proto.query = function* (sql, values) {
try {
return yield this._query(sql);
} catch (err) {
err.message += ' (sql: ' + sql + ')';
err.stack = err.stack + '\n sql: ' + sql;
debug('query error: %s', err);
throw err;
}
Expand Down
1 change: 1 addition & 0 deletions test/client.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ describe('test/client.test.js', function () {
// error, rollback
yield conn.rollback(); // rollback call won't throw err
assert.equal(err.code, 'ER_PARSE_ERROR');
assert(/sql: insert into/.test(err.stack), err.stack);
} finally {
// should release connection whatever
conn.release();
Expand Down

0 comments on commit 54349cd

Please sign in to comment.