Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@slonik/pg-driver
Advanced tools
A Node.js PostgreSQL client with strict types, detailed logging and assertions.
pg
import {
createPgDriverFactory,
DatabaseError,
} from '@slonik/pg-driver';
All Slonik errors extend from SlonikError
. SlonikError
uses cause
property to store the original error, which might be a DatabaseError
from pg
. Example:
pool.on('error', (error) => {
const cause = error.cause;
if (cause instanceof DatabaseError) {
console.log(cause.code);
}
});
This allows you to handle errors based on the lower-level error codes provided by pg
driver.
Example of handling all errors that could warrant a fatal error:
const fatalErrorClasses = [
// Connection Exception
'08',
// Invalid Authorization Specification
'28',
];
pool.on('error', (error) => {
if (error.cause instanceof DatabaseError) {
const classCode = error.cause.code.slice(0, 2);
if (fatalErrorClasses.includes(classCode)) {
// Initiate shutdown due to unexpected connection state.
}
}
});
FAQs
A Node.js PostgreSQL client with strict types, detailed logging and assertions.
The npm package @slonik/pg-driver receives a total of 10,639 weekly downloads. As such, @slonik/pg-driver popularity was classified as popular.
We found that @slonik/pg-driver demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.