🚀. Socket Launch Week Day 2:Introducing Manifest Alerts.Learn more
Sign In

@rxstack/exceptions

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rxstack/exceptions

RxStack Exceptions Component

Source
npmnpm
Version
0.1.5
Version published
Weekly downloads
104
153.66%
Maintainers
1
Weekly downloads
 
Created
Source

The RxStack Exceptions

The Exception component contains a set of standard exception classes. They set the correct HTTP status codes for REST calls and socket responses.

Installation

npm install @rxstack/exceptions --save

Documentation

  • Standard exceptions
  • Helpers

Standard exceptions

The following exception types, all of which are instances of base Exception class are available:

  • 400: BadRequest
  • 401: Unauthorized
  • 402: PaymentRequired
  • 403: Forbidden
  • 404: NotFound
  • 405: MethodNotAllowed
  • 406: NotAcceptable
  • 407: ProxyAuthenticationRequired
  • 408: RequestTimeout
  • 409: Conflict
  • 410: Gone
  • 411: LengthRequired
  • 412: PreconditionFailed
  • 413: PayloadTooLarge
  • 414: URITooLong
  • 415: UnsupportedMediaType
  • 416: Satisfiable
  • 417: ExpectationFailed
  • 422: UnprocessableEntity
  • 429: TooManyRequests
  • 451: UnavailableForLegalReasons
  • 500: HttpException
  • 501: NotImplemented
  • 502: BadGateway
  • 503: Unavailable
  • 507: InsufficientStorage

Exceptions contain the following fields:

  • name: The error name
  • message: The error message
  • stack: The error stack
  • data: extra data
  • statusCode: The HTTP status code

Helpers

To transform a native error to exception, you can use:

import {transformToException} from '@rxstack/exceptions'

// returns instance of Exception
transformToException(error);

License

Licensed under the MIT license.

Keywords

rxstack

FAQs

Package last updated on 05 Mar 2019

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