Skip to content

Commit 02fd305

Browse files
committed
fix: this.end is not a function error
1 parent 3878176 commit 02fd305

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/lib/db.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,11 @@ ${' '.repeat(5 + lineNumber.toString().length + 2 + lineOffset)}^
198198
}
199199
return { data: null, error: { code: error.code, message: error.message } }
200200
} finally {
201-
// If the error isn't a "DatabaseError" assume it's a connection related we kill the connection
202-
// To attempt a clean reconnect on next try
203-
await this.end()
201+
if (this && this.end) {
202+
// If the error isn't a "DatabaseError" assume it's a connection related we kill the connection
203+
// To attempt a clean reconnect on next try
204+
await this.end()
205+
}
204206
}
205207
}
206208
},

0 commit comments

Comments
 (0)