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

code-added-error

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

code-added-error

Emulation of basic Error class, with new "code" argument and "file" & "line" static methods

  • 0.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

code-added-error

Emulation of basic Error class, with new "code" argument and "file" & "line" static methods

Build status Coverage status Dependency status Dev dependency status Issues Pull requests

Installation

$ npm install code-added-error

Features

Official

Supported

  • Error
  • prototype
  • fileName
  • lineNumber
  • message
  • name
  • stack
  • toString

Supported, non-official

  • toJSON
  • static file
  • static line

Not supported

  • columnNumber
  • toSource

Doc

-- Attributes --

  • name: string plugins' directory path
  • message: string plugins' directory path
  • fileName: string plugins' directory path
  • lineNumber: number plugins' directory path
  • stack: string plugins' directory path

-- Constructor --

  • constructor(message: string, code?: string, fileName?: string, lineNumber?: string)

-- Methods --

  • toString(codeAndMessageOnly?: boolean): string return string-formated error
  • toJSON(codeAndMessageOnly?: boolean): object return JSON-formated error
  • static file(): string return current file
  • static line(): number return current line

Examples

"use strict";

const CodeAddedError = require('code-added-error');

const err = new CodeAddedError("This is a test", "TEST", CodeAddedError.file(), CodeAddedError.line());

console.log(err.name);
console.log(err.message);
console.log(err.toString());
console.log(err.toJSON());

Typescript

"use strict";

import CodeAddedError = require('code-added-error');

const manager = new CodeAddedError("This is a test", "TEST");

console.log(err.name);
console.log(err.message);
console.log(err.toString());
console.log(err.toJSON());

Tests

$ npm run-script tests

License

ISC

Keywords

FAQs

Package last updated on 29 May 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

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