Socket
Socket
Sign inDemoInstall

make-error-cause

Package Overview
Dependencies
1
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.1 to 1.2.2

README.md

3

dist/index.d.ts
import makeError = require('make-error');
declare function makeErrorCause(value: string | Function): makeErrorCause.Constructor<makeErrorCause.BaseError>;
declare function makeErrorCause<T extends Error>(value: string | Function, _super: {
new (...args: any[]): T;
}): makeErrorCause.Constructor<T>;
declare namespace makeErrorCause {

@@ -4,0 +7,0 @@ class BaseError extends makeError.BaseError {

@@ -6,10 +6,18 @@ "use strict";

var TestError = makeErrorCause('TestError');
var SubTestError = makeErrorCause('SubTestError', TestError);
t.test('render the cause', function (t) {
var cause = new Error('boom!');
var error = new TestError('something bad', cause);
var again = new TestError('more bad', error);
var again = new SubTestError('more bad', error);
t.equal(error.cause, cause);
t.equal(error.toString(), 'TestError: something bad\nCaused by: Error: boom!');
t.ok(error instanceof Error);
t.ok(error instanceof makeErrorCause.BaseError);
t.ok(error instanceof TestError);
t.equal(again.cause, error);
t.equal(again.toString(), 'TestError: more bad\nCaused by: TestError: something bad\nCaused by: Error: boom!');
t.equal(again.toString(), 'SubTestError: more bad\nCaused by: TestError: something bad\nCaused by: Error: boom!');
t.ok(again instanceof Error);
t.ok(again instanceof makeErrorCause.BaseError);
t.ok(again instanceof TestError);
t.ok(again instanceof SubTestError);
t.end();

@@ -16,0 +24,0 @@ });

8

package.json
{
"name": "make-error-cause",
"version": "1.2.1",
"version": "1.2.2",
"description": "Make your own nested error types!",

@@ -41,9 +41,9 @@ "main": "dist/index.js",

"devDependencies": {
"blue-tape": "^0.2.0",
"blue-tape": "^1.0.0",
"istanbul": "1.0.0-alpha.2",
"tap-spec": "^4.1.1",
"ts-node": "^0.9.0",
"ts-node": "^1.1.0",
"tslint": "^3.10.2",
"tslint-config-standard": "^1.0.0",
"typescript": "^1.7.3",
"typescript": "^2.0.3",
"typings": "^1.3.1"

@@ -50,0 +50,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc