Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@smithy/service-error-classification
Advanced tools
[![NPM version](https://img.shields.io/npm/v/@smithy/service-error-classification/latest.svg)](https://www.npmjs.com/package/@smithy/service-error-classification) [![NPM downloads](https://img.shields.io/npm/dm/@smithy/service-error-classification.svg)](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
[![NPM version](https://img.shields.io/npm/v/@smithy/service-error-classification/latest.svg)](https://www.npmjs.com/package/@smithy/service-error-classification) [![NPM downloads](https://img.shields.io/npm/dm/@smithy/service-error-classification.svg)](h
The npm package @smithy/service-error-classification receives a total of 15,240,717 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 0 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.