Skip to content

Commit 69f1ec0

Browse files
committed
added more error handling
1 parent 05bfb9d commit 69f1ec0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/storage.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ import { MysqlError, Pool } from 'mysql';
99
* @param callback Callback function
1010
* @param pool Pool to use
1111
*/
12-
export function query(query: string, inputs: any[], callback: (error: MysqlError, result: any[]) => void, pool: Pool) {
12+
export function query(query: string, inputs: any[], callback: (error: MysqlError, result: any[]) => void, pool: Pool) : void {
1313
pool.getConnection(function (error, connection) {
14+
if (error) callback(error, []);
1415
connection.beginTransaction(function (error) {
1516
if (error) {
1617
// Transaction Error (Rollback and release connection)

0 commit comments

Comments
 (0)