diff --git a/packages/turso-serverless/src/connection.ts b/packages/turso-serverless/src/connection.ts index 418822136..facc21562 100644 --- a/packages/turso-serverless/src/connection.ts +++ b/packages/turso-serverless/src/connection.ts @@ -94,6 +94,9 @@ export class Connection { * @returns Promise resolving to the result of the pragma */ async pragma(pragma: string): Promise { + if (!this.isOpen) { + throw new TypeError("The database connection is not open"); + } const sql = `PRAGMA ${pragma}`; return this.session.execute(sql); }