Skip to content

Commit

Permalink
fix: add missing sql and parameters properties to some query errors (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards1211 committed May 23, 2020
1 parent c31d68d commit d7fcf21
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/dialects/mssql/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ class Query extends AbstractQuery {
return new Promise((resolve, reject) => {
const handleTransaction = err => {
if (err) {
err.sql = sql;
err.parameters = parameters;
reject(this.formatError(err));
return;
}
Expand Down
2 changes: 2 additions & 0 deletions lib/dialects/postgres/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ class Query extends AbstractQuery {
if (rows[0] && rows[0].sequelize_caught_exception !== undefined) {
if (rows[0].sequelize_caught_exception !== null) {
throw this.formatError({
sql,
parameters,
code: '23505',
detail: rows[0].sequelize_caught_exception
});
Expand Down

0 comments on commit d7fcf21

Please sign in to comment.