Open
Description
This is the code,
import pg from "pg";
try {
const c = new pg.Client({ host: "192.168.0.155", port: 5432, user: "postgres", password: "abcd123", database: "db1234" });
await c.connect();
} catch (error) {
console.error(error);
}
The app crashes with following log
error: database "db1234" does not exist
at Parser.parseErrorMessage (D:\git\github\entity-access\entity-access\node_modules\pg-protocol\dist\parser.js:283:98)
at Parser.handlePacket (D:\git\github\entity-access\entity-access\node_modules\pg-protocol\dist\parser.js:122:29)
at Parser.parse (D:\git\github\entity-access\entity-access\node_modules\pg-protocol\dist\parser.js:35:38)
at Socket.<anonymous> (D:\git\github\entity-access\entity-access\node_modules\pg-protocol\dist\index.js:11:42)
at Socket.emit (node:events:520:28)
at addChunk (node:internal/streams/readable:559:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
at Readable.push (node:internal/streams/readable:390:5)
at TCP.onStreamRead (node:internal/stream_base_commons:191:23) {
length: 92,
severity: 'FATAL',
code: '3D000',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'postinit.c',
line: '1019',
routine: 'InitPostgres'
}
The big problem with this error stack is, it doesn't give information about where the error has occurred.
There are various such places, and I can see that since original pg library is callback based and promisify is converting callback based functions to async variant, but this is a real big issue.
Metadata
Metadata
Assignees
Labels
No labels