Skip to content

Commit 00e8963

Browse files
committed
chore: add better logging for when analysis fails for a single query
1 parent 1a0478d commit 00e8963

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/sync/seen-cache.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { Postgres } from "@query-doctor/core";
22
import { QueryHash, RawRecentQuery, RecentQuery } from "../sql/recent-query.ts";
33
import { fingerprint } from "@libpg-query/parser";
4+
import { log } from "../log.ts";
45

56
interface CacheEntry {
67
firstSeen: number;
@@ -50,7 +51,13 @@ export class QueryCache {
5051
// TODO: bound the concurrency
5152
return await Promise.all(rawQueries.map(async (rawQuery) => {
5253
const key = await this.store(rawQuery);
53-
return RecentQuery.analyze(rawQuery, key, this.getFirstSeen(key));
54+
try {
55+
return await RecentQuery.analyze(rawQuery, key, this.getFirstSeen(key));
56+
} catch (error) {
57+
log.error(`Failed to analyze query ${rawQuery.query}`, "query-cache")
58+
console.error(error)
59+
throw error;
60+
}
5461
}));
5562
}
5663

0 commit comments

Comments
 (0)