
Research
Supply Chain Attack on Axios Pulls Malicious Dependency from npm
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.
goerrify is a lightweight utility library that brings Go-style error handling to your JavaScript and TypeScript projects. It provides two simple yet powerful functions, errify and errifyAll, that enable you to handle asynchronous operations with the clari
The goerrify package provides utilities to simplify error handling in JavaScript, inspired by Go's approach. It offers two functions:
errify: Asynchronously wraps a promise and returns an array containing the resolved value (if successful) or null and the caught error (if rejected).errifyAll: Asynchronously handles a collection of promises using Promise.allSettled, returning an array of arrays where each inner array contains the resolved value or null and the corresponding error (if any).Installation
npm install goerrify
Usage
CommonJS
const { errify, errifyAll } = require('goerrify');
async function fetchData() {
try {
const response = await fetch('https://api.example.com/data');
return await response.json();
} catch (err) {
return null;
}
}
async function main() {
const [data, err] = await errify(fetchData());
if (err) {
console.error('Error fetching data:', err);
return;
}
console.log('Fetched data:', data);
// Using errifyAll for multiple promises
const promises = [fetchData(), anotherPromise(), ...];
const results = await errifyAll(promises);
results.forEach(([result, error]) => {
if (error) {
console.error('Error in promise:', error);
} else {
console.log('Result:', result);
}
});
}
main();
Modules (ES6+)
import { errify, errifyAll } from 'goerrify';
async function fetchData() {
try {
const response = await fetch('https://api.example.com/data');
return await response.json();
} catch (err) {
return null;
}
}
async function main() {
const [data, err] = await errify(fetchData());
if (err) {
console.error('Error fetching data:', err);
return;
}
console.log('Fetched data:', data);
// Using errifyAll for multiple promises
const promises = [fetchData(), anotherPromise(), ...];
const results = await errifyAll(promises);
results.forEach(([result, error]) => {
if (error) {
console.error('Error in promise:', error);
} else {
console.log('Result:', result);
}
});
}
main();
Key Points
errify provides a concise way to handle individual promises, returning both the result and any encountered error in a single array.errifyAll is useful for managing collections of promises, allowing you to efficiently process their outputs and errors in a single loop.Benefits of goerrify
try...catch blocks.Additional Considerations
goerrify simplifies common error handling patterns, complex scenarios might still require more elaborate error management strategies.bluebird for advanced promise handling features.License MIT
FAQs
goerrify is a lightweight utility library that brings Go-style error handling to your JavaScript and TypeScript projects. It provides two simple yet powerful functions, errify and errifyAll, that enable you to handle asynchronous operations with the clari
We found that goerrify demonstrated a not healthy version release cadence and project activity because the last version was released 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.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.

Security News
TeamPCP is partnering with ransomware group Vect to turn open source supply chain attacks on tools like Trivy and LiteLLM into large-scale ransomware operations.