ReviewOS

stacks/bun-query-builder

Dead sql.catch block in getBunSql — handler can never fire and would re-mask #1022 errors

#1039
Closed glennmichael123 opened this 2 months ago ·
2 months ago

Summary

In getBunSql, the if (sql && typeof (sql as any).catch === 'function') block is dead — Bun's SQL instance is not a Promise and has no .catch, so the guard is always false. Even if it fired, it's verbose-gated and filters out exactly the "database…does not exist" errors that #1022 was about surfacing — contradicting the fail-loudly fix ~30 lines below.

Location

src/db.ts:~430-436.

Suggested fix

Delete the block. Connection errors are already handled by the try/catch (re-throw) and the process-level handler.

Severity: low (cleanup). Found via internal code audit.

9 days ago

Fixed in 4bbb15a. Removed the dead if (typeof sql.catch === 'function') handler — a Bun SQL instance has no .catch (verified undefined), so it never ran, and would have re-masked the very 'database does not exist' errors #1022 made loud. Behavior unchanged; full suite green.

Sign in to comment on this issue.