Skip to content

Commit e50af8d

Browse files
Patrick BanksPatrick Banks
authored andcommitted
Fix bug unhandle exception
1 parent 6611739 commit e50af8d

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/trader/apis/postgres.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,9 @@ async function execute(commands: string[], params?: any[]) {
201201
const command = commands[i]
202202
const param = params ? params[i] : undefined
203203
logger.silly(`Executing: ${command} ${param}`)
204-
client.query(command, param)
204+
await client.query(command, param)
205205
}
206-
}
207-
finally {
206+
} finally {
208207
client.release()
209208
}
210209
}
@@ -214,9 +213,8 @@ async function query(command: string, params?: any): Promise<QueryResult<any>> {
214213
const client = await pool.connect()
215214
logger.silly(`Querying: ${command} ${params}`)
216215
try {
217-
return client.query(command, params)
218-
}
219-
finally {
216+
return await client.query(command, params)
217+
} finally {
220218
client.release()
221219
}
222220
}

0 commit comments

Comments
 (0)