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

@fastify/error

Package Overview
Dependencies
Maintainers
18
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fastify/error - npm Package Compare versions

Comparing version 3.4.0 to 3.4.1

.gitattributes

2

index.js

@@ -26,3 +26,3 @@ 'use strict'

const lastElement = args.length - 1
if (lastElement !== 1 && args[lastElement] && typeof args[lastElement] === 'object' && 'cause' in args[lastElement]) {
if (lastElement !== -1 && args[lastElement] && typeof args[lastElement] === 'object' && 'cause' in args[lastElement]) {
this.cause = args.pop().cause

@@ -29,0 +29,0 @@ }

{
"name": "@fastify/error",
"version": "3.4.0",
"version": "3.4.1",
"description": "A small utility, used by Fastify itself, for generating consistent error objects across your codebase and plugins.",
"main": "index.js",
"type": "commonjs",
"types": "types/index.d.ts",

@@ -7,0 +8,0 @@ "scripts": {

'use strict'
const test = require('tap').test
const { test } = require('tap')
const createError = require('..')

@@ -166,2 +166,12 @@

test('Create an error with cause and message', t => {
t.plan(2)
const cause = new Error('HEY')
const NewError = createError('CODE', 'Not available: %s')
const err = NewError('foo', { cause })
t.ok(err instanceof Error)
t.equal(err.cause, cause)
})
test('Create an error with last argument null', t => {

@@ -168,0 +178,0 @@ t.plan(2)

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