New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

throw-http

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

throw-http

throw-http

latest
Source
npmnpm
Version
1.0.7
Version published
Maintainers
1
Created
Source

throw-http

Introduction

Throw-http is an Error utility for handling http errors in a delightful way. I created it because existing libraries are not type-safe, not correctly exported or don't allow to pass additional data in the error.

Installation

To get started, install http-throw using npm or yarn:

npm install throw-http
# or
yarn add throw-http

Usage

Throwing an ThrowHttp error

import { ThrowHttp } from 'throw-http';

throw new ThrowHttp.NotFound('User not found');

Throwing a custom ThrowHttp error

import { ThrowHttp } from 'throw-http';

throw new ThrowHttp({ code: 500, name: 'Badaboom' });

Typeguard for ThrowHttp

import { ThrowHttp } from 'throw-http';

try {
  // some code
} catch (error) {
  if (ThrowHttp.isThrowHttp(error)) {
    // handle http error
  }
}

Keywords

http

FAQs

Package last updated on 05 Jun 2025

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