ReviewOS

stacks/bun-query-builder

Library installs a process-wide unhandledRejection handler that silently swallows DB errors

#1040
Closed glennmichael123 opened this 22 days ago · 0 comments
22 days ago

Summary

Importing db.ts installs a process-level unhandledRejection listener that suppresses any rejection whose message contains "database"/"does not exist" or code 3D000/ERR_POSTGRES_SERVER_ERROR. The comment says "during tests," but this runs in every consumer's process and will mask genuine production rejections (e.g. a real "relation does not exist" bug). A library installing a silent global rejection handler is a strong smell.

Location

src/db.ts:~540-558.

Suggested fix

Scope this to test setup only (a test preload), or at minimum log under config.verbose instead of fully suppressing.

Severity: medium. Found via internal code audit.

Sign in to comment on this issue.