node-pg-error icon indicating copy to clipboard operation
node-pg-error copied to clipboard

22P02 errors could use more detail

Open joeybaker opened this issue 8 years ago • 1 comments

I'm not sure if this is a bug in parsing, or if PG just doesn't give the data, but 22P02 errors could use more detail. An example:

error: invalid input syntax for integer: "I should be an int!"
       at …
     name: 'error',
     length: 85,
     severity: 'ERROR',
     code: '22P02',
     detail: undefined,
     hint: undefined,
     position: '118',
     internalPosition: undefined,
     internalQuery: undefined,
     where: undefined,
     schema: undefined,
     table: undefined,
     column: undefined,
     dataType: undefined,
     constraint: undefined,
     file: 'int8.c',
     line: '99',
     routine: 'scanint8',

It would be great if more detail like detail, schema, table, column, and dataType were available.

joeybaker avatar Aug 03 '16 16:08 joeybaker

Hey,

When you print out what the internal parse function returns, does that contain more info? https://github.com/moll/node-pg-error/blob/c594e7c73c2f47a7994c7136382125ca948a2893/index.js#L43

If not, then I'm afraid there's nothing we can do but ask Pg to add more information to its errors.

moll avatar Aug 03 '16 17:08 moll