
Security News
New CVE Forecasting Tool Predicts 47,000 Disclosures in 2025
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
silent-error
Advanced tools
The silent-error npm package is designed to create and handle errors in a way that is silent, meaning it does not immediately throw or log the error. This can be useful in scenarios where you want to handle errors gracefully without disrupting the flow of your application.
Creating a Silent Error
This feature allows you to create a silent error with a custom message. The error can be logged or handled without immediately throwing it.
const SilentError = require('silent-error');
const error = new SilentError('This is a silent error');
console.log(error.message); // Output: This is a silent error
Handling Silent Errors
This feature demonstrates how to handle silent errors using a try-catch block. It checks if the error is an instance of SilentError and handles it accordingly.
const SilentError = require('silent-error');
try {
throw new SilentError('This is a silent error');
} catch (error) {
if (error instanceof SilentError) {
console.log('Handled a silent error:', error.message);
} else {
throw error;
}
}
The verror package provides a way to create and handle nested errors with additional context. It is more focused on error wrapping and providing detailed error messages compared to silent-error.
The custom-error-generator package allows you to create custom error types with additional properties. It is similar to silent-error in that it provides a way to create custom errors, but it offers more flexibility in defining error properties.
The create-error package is a simple utility for creating custom error types. It is similar to silent-error but focuses on simplicity and ease of use for creating custom errors.
An error subclass for humanized errors. This module allows for inter-module detection of errors which are fatal, but where a stacktrace by default provides negative value.
Some use-cases:
Obviously stack traces can still be valuable. To view the stacks, the following environment variable can be set to true
SILENT_ERROR=verbose <run program>
// in one node module
async function runCommand(name) {
// some logic
throw new SilentError(`command: '${name}' is not installed`);
}
// in another node_module
async function caller() {
try {
await runCommand('foo');
} catch(e) {
SilentError.debugOrThrow(e);
}
SilentError.debugOrThrow
}
yarn add silent-error
or
npm install --save silent-error
FAQs
stackless unless otherwise requested error
The npm package silent-error receives a total of 292,048 weekly downloads. As such, silent-error popularity was classified as popular.
We found that silent-error 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.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.