-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Standardizing on a single error type #972
Comments
Aligning error reporting between In fact, I think it would be so serious, the library would need to change over to version 5.0.0 to accommodate the change, or else it will break the hell of people's code. If we are to try this within 4.x branch, this universal error reporting should be made optional, off by default. |
I also think this would require a major version bump. I think it's worth it, though, especially when the library advertises that |
Unfortunately, this isn't true, and not just because of the error handling, but some most important modules, like pg-query-stream do not even support the native bindings. In fact, last I tried - the connection pool didn't work for me, so I gave up on the native version long ago. The differences are too substantial. |
can you elaborate on this? |
|
This change requires a lot of work to achieve API compatibility with node-postgres, at the very least there's a report of a problem with connection pools, in addition the error objects have a completely different format in pg-native. - brianc/node-pg-native#46 - brianc/node-postgres#972
This change requires a lot of work to achieve API compatibility with node-postgres, at the very least there's a report of a problem with connection pools, in addition the error objects have a completely different format in pg-native. - brianc/node-pg-native#46 - brianc/node-postgres#972
@kevinburkeshyp I'd like to retract my previous statement here. |
After having added And if someone uses errors and moves from one version of the library to another - that will be a pain. |
@kevinburke any progress here? I think this will make one useful addition to the library. I've done a lot of implementation for custom errors. See here some nice code: https://github.com/vitaly-t/pg-promise/blob/master/lib/errors.js In the same way, you would have:
just to give you a good example of how to write custom errors for Node.js ;) |
@kevinburkeshyp if someone decides to implement this feature, the following projects should be consulted: pg-rethrow + pg-error-codes. @brianc There seems to be a lot of helpers around to unite all this under one roof and make consistent across the entire platform. Would you consider a PR for this? If so, please label it as a feature request. |
Got bitten by this peculiarity today after replacing Now I place |
Since this is a breaking change I needed to hold off until doing a new major version bump. I've added this to the |
* Add client connectionString tests (#1310) * Remove redundant tests * Add client connectionString test Add test to ensure { connectionString } is respected as an argument to the client constructor * Add test for connection string property Also fixed some legacy require statements. * Normalize native error properties Map native error properties to the same property names we use for errors from the JS driver. Fixes #972 Fixes #938
I have this fixed on the 7.0 branch. Fix will be released in 7.0. |
* Add client connectionString tests (#1310) * Remove redundant tests * Add client connectionString test Add test to ensure { connectionString } is respected as an argument to the client constructor * Add test for connection string property Also fixed some legacy require statements. * Normalize native error properties Map native error properties to the same property names we use for errors from the JS driver. Fixes #972 Fixes #938
Hi Brian - we just got bit by #938 and I am hoping to fix the issue.
Per your comment here:
It sounds like your proposed solution is to keep the
node-postgres
error API consistent, and transform error objects coming frompg-native
, instead of:does that sound right? i'll start working on a patch.
The text was updated successfully, but these errors were encountered: