serverless: Improve pragma() after close() error

This commit is contained in:
Pekka Enberg
2025-08-06 09:09:47 +03:00
parent 66b4de1ad9
commit 2a36d133e3

View File

@@ -94,6 +94,9 @@ export class Connection {
* @returns Promise resolving to the result of the pragma
*/
async pragma(pragma: string): Promise<any> {
if (!this.isOpen) {
throw new TypeError("The database connection is not open");
}
const sql = `PRAGMA ${pragma}`;
return this.session.execute(sql);
}