v.1.3.0
Error Handling
This release is a major re-work on the error handling mechanism within the library, with focus on errors related to failed database connections, to make sure they are rejected and reported just the same as the rest of the errors.
Any connection-related error is now reported within the error event, and always rejected correctly.
There has been an overall change in the way errors are reported through events and as rejections. All errors and on all levels are now reported with the original Error
object, and not just its text message as it was before, giving you access to the calling stack, among other useful attributes of the object.
Despite the huge scope of changes, none should break the existing code, they only provide more detail and better error handling.
Other Changes
- Method
tx
has received aliastransact
; - Method
queryRaw
has received aliasraw
; - Lots of new tests written for connection and error handling;
- Improved code samples;
Other than that, some major code refactoring was done, with improvements ranging from promises reuse (to avoid anti-pattern), to protocol instantiation.
Notes
The only kicking issue that remains around connections is one within node-postgres: Unhandled errors during connection.
It is because of this long ongoing bug this library has 3 tests commented out, unfortunately.
Basically, node-postgres throws an unhandled error in the following cases:
- Invalid user name in the connection;
- Invalid password in the connection;
- Invalid connection string passed.
I'm just waiting for the node-postgres author to fix it, same as everybody else.