Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@smithy/service-error-classification

Package Overview
Dependencies
Maintainers
2
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@smithy/service-error-classification

[![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

  • 3.0.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
17M
decreased by-3.7%
Maintainers
2
Weekly downloads
 
Created

What is @smithy/service-error-classification?

@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.

What are @smithy/service-error-classification's main functionalities?

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.');
}

Other packages similar to @smithy/service-error-classification

FAQs

Package last updated on 13 Sep 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc