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

jwplayer-errors

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jwplayer-errors

A standardized set of errors used by JWPlayer

  • 1.0.3
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

JWPlayer Errors

This repo contains a standardized, numerical set of errors used by JWPlayer and its plugins.

Installation

npm i -D jwplayer-errors

Usage

Importing

Each module is a named export:

build, Category, Code, Severity, Data

You can import them all with the following syntax:

import * as JWError from 'jwplayer-errors;'

Or individually:

import Category from 'jwplayer-errors;'

Building errors

Errors are composed of a Category, Code, Severity, and an optional Data object, which are passed into the build function with the following signature:

build(category, code, severity, data)

The build function uses these arguments to generate a standardized error message, which it returns along with the numerical values (while omitting the data object):

{
    category,
    code,
    severity,
    message
}

Important!: The data argument must be created with a factory function from the JWError.Data module. Data arguments are expected to conform to a certain structure.

Example

import * as JWError from `jwplayer-errors`;

const networkErrorData = JWError.Data.Network('https://jwplayer.com', 404, 'Not found');

const error = JWError.build(
    JWError.Category.NETWORK,
    JWError.Code.BAD_HTTP_STATUS,
    JWError.Severity.FATAL,
    networkErrorData
);

FAQs

Package last updated on 01 May 2017

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