
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
@smithy/service-error-classification
Advanced tools
[](https://www.npmjs.com/package/@smithy/service-error-classification) [](h
@smithy/service-error-classification is an npm package designed to help classify and handle service errors in a structured and consistent manner. It provides utilities to identify different types of errors, such as client errors, server errors, and throttling errors, and allows developers to handle these errors appropriately in their applications.
Classify Client Errors
This feature allows you to classify whether an error is a client error (4xx status codes). The code sample demonstrates how to use the `isClientError` function to check if an error is a client error.
const { isClientError } = require('@smithy/service-error-classification');
const error = { statusCode: 400 };
if (isClientError(error)) {
console.log('This is a client error.');
}
Classify Server Errors
This feature allows you to classify whether an error is a server error (5xx status codes). The code sample demonstrates how to use the `isServerError` function to check if an error is a server error.
const { isServerError } = require('@smithy/service-error-classification');
const error = { statusCode: 500 };
if (isServerError(error)) {
console.log('This is a server error.');
}
Classify Throttling Errors
This feature allows you to classify whether an error is a throttling error (typically 429 status code). The code sample demonstrates how to use the `isThrottlingError` function to check if an error is a throttling error.
const { isThrottlingError } = require('@smithy/service-error-classification');
const error = { statusCode: 429 };
if (isThrottlingError(error)) {
console.log('This is a throttling error.');
}
The `http-errors` package is used to create HTTP errors for use in Express and other web frameworks. It provides a simple way to create error objects with HTTP status codes and messages. Unlike @smithy/service-error-classification, it focuses on creating errors rather than classifying them.
The `axios` package is a popular HTTP client for making requests. It includes built-in error handling that can classify errors based on HTTP status codes. While it provides some similar functionality to @smithy/service-error-classification, its primary focus is on making HTTP requests rather than error classification.
The `boom` package is used to create HTTP-friendly error objects. It is often used with the Hapi.js framework but can be used with any Node.js application. It provides utilities to create errors with specific status codes and messages, similar to @smithy/service-error-classification, but it does not focus on classifying existing errors.
FAQs
[](https://www.npmjs.com/package/@smithy/service-error-classification) [](h
The npm package @smithy/service-error-classification receives a total of 20,856,124 weekly downloads. As such, @smithy/service-error-classification popularity was classified as popular.
We found that @smithy/service-error-classification demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers 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
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.