Skip to content

Commit

Permalink
Merge pull request #951 from gjsjohnmurray/fix-912
Browse files Browse the repository at this point in the history
Report MySQL connection test failure (#912)
  • Loading branch information
gjsjohnmurray committed Sep 2, 2022
2 parents 5b5bfc1 + 3103294 commit e5f12db
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/driver.mysql/src/ls/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ export default class MySQLDefault extends AbstractDriver<MySQLLib.Pool, MySQLLib
}
});
});
}).catch((reason) => {
throw new Error(reason.message);
});
}

Expand Down
3 changes: 3 additions & 0 deletions packages/driver.mysql/src/ls/driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ export default class MySQL<O = any> extends AbstractDriver<any, O> implements IC
public query: (typeof AbstractDriver)['prototype']['query'] = (query, opt = {}) => {
return this.driver.query(query, opt)
.catch(err => {
if (opt.throwIfError) {
throw new Error(err.message);
}
return [<NSDatabase.IResult>{
connId: this.getId(),
requestId: opt.requestId,
Expand Down

0 comments on commit e5f12db

Please sign in to comment.