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

@magic/error

Package Overview
Dependencies
Maintainers
2
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@magic/error

errors for @magic

  • 0.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
401
increased by15.56%
Maintainers
2
Weekly downloads
 
Created
Source

@magic/error

throw errors with custom code/name.

html-docs

NPM version Linux Build Status Windows Build Status Coverage Status Greenkeeper badge Known Vulnerabilities

installation:
npm install @magic/error
usage:
import error from '@magic/error'

err = error('message', 'name')
// { message: 'message', name: 'E_NAME', code: 'E_NAME' }

err = error('message')
// { message: 'message', name: 'E_UNKNOWN', code: 'E_UNKNOWN' }

err = error(new Error('message'))
// { message: 'message', name: 'Error', code: 'E_UNKNOWN' }

throw err
// the stacktrace will be as expected,
// not including the file in this lib that this error was instantiated in.
changelog
0.0.1

first commit

0.0.2
  • errors can be passed as first argument
  • error.name is unchanged, error.code gets transformed to start with E_ and be uppercased.
  • error.code for passed in errors is E_UNKNOWN.
0.0.3 - unreleased

...

FAQs

Package last updated on 16 Jan 2020

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