db0
db0 copied to clipboard
refactor(postgres): throw better error on connection fail
โ Type of change
- [ ] ๐ Documentation (updates to the documentation, readme, or JSdoc annotations)
- [ ] ๐ Bug fix (a non-breaking change that fixes an issue)
- [X] ๐ Enhancement (improving an existing functionality like performance)
- [ ] โจ New feature (a non-breaking change that adds functionality)
- [ ] ๐งน Chore (updates to the build process or auxiliary tools and libraries)
- [ ] โ ๏ธ Breaking change (fix or feature that would cause existing functionality to change)
๐ Description
currently, if no connection can be established the error simply says
ECONNREFUSED: Failed to connect
When using db0 in e.g. Nitro this does not tell you a lot. With this PR the message looks like this:
ECONNREFUSED: Failed to connect - could not connect to Postgres DB at ""
this clearly tells you that something is wrong with your postgres db
๐ Checklist
- [ ] I have linked an issue or discussion.
- [ ] I have updated the documentation accordingly.
Note
currently, the connector in the postgresql.ts is called sqliteConnector
. Which I don't think it should. If you agree let me know and I will quickly create a PR for it.