question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Standardizing on a single error type

See original GitHub issue

Hi Brian - we just got bit by https://github.com/brianc/node-postgres/issues/938 and I am hoping to fix the issue.

Per your comment here:

This is probably something that should be normalized within node-postgres itself rather than here in the native lib. If you wanna take a crack at it over there I’ll happily review the PR!

It sounds like your proposed solution is to keep the node-postgres error API consistent, and transform error objects coming from pg-native, instead of:

  • changing the error objects here to match the ones in the pg-native library
  • changing the error objects in pg-native to match the error here.

does that sound right? i’ll start working on a patch.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:12 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
rkaw92commented, Jul 12, 2016

Got bitten by this peculiarity today after replacing require('pg') with require('pg').native. I had had some error handlers that checked the error.code property for known values, because the code expected some tables to already exist and treated a failed CREATE TABLE like a nominal case, but only for specified error codes (“SQL states”).

Now I place error.code === '42P07' || error.sqlState === '42P07' in my handlers…

0reactions
brianccommented, Jun 9, 2017

I have this fixed on the 7.0 branch. Fix will be released in 7.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Case for Standardized Error Handling in Your Web ...
I'm making the case for standardizing error handling from APIs so we can all stop ... The error response MUST be a single...
Read more >
When and why to standardize a variable - ListenData
This tutorial explains when, why and how to standardize a variable in statistical modeling. Variable Standardization is one of the most important concept...
Read more >
Standardization - Dimewiki - World Bank
Standardizations is not an abstract concept difficult to have an intuition for, but there are very large sources of errors if bad practices...
Read more >
Process standardization and error reduction: A revisit from a ...
Standardization can, on the one hand, weaken the employees' choice by guiding them to operate uniformly and follow instructions in order not to...
Read more >
When Do You Need to Standardize the Variables in a ...
Yes, standardizing the variables can change the p-values. There's one prime reason I can think of off the top of my head–structural multicollinearity....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found