Socket
Socket
Sign inDemoInstall

@blackglory/errors

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blackglory/errors

Common errors


Version published
Weekly downloads
1K
increased by36.89%
Maintainers
1
Weekly downloads
 
Created
Source

errors

Common errors.

Install

npm install --save @blackglory/errors
# or
yarn add @blackglory/errors

API

Interfaces

type CustomErrorConstructor<T extends CustomError = CustomError> = new (message?: string) => T

interface SerializableError {
  name: string
  message: string
  stack: string | null
}

CustomError

class CustomError extends Error {}

ExpectedError

class ExpectedError extends CustomError {}

AssertionError

class AssertionError extends CustomError {}

normalize

function normalize(err: Error): SerializableError

assert

/**
 * @throws {AssertionError}
 */
function assert(condition: unknown, message?: string): asserts condition

refute

/**
 * @throws {ExpectedError}
 */
function refute(condition: unknown, message?: string): void

A negative assertion, expects the condition to be falsy.

FAQs

Package last updated on 04 Feb 2021

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