@fastify/error
Advanced tools
Comparing version 3.2.1 to 3.3.0
21
index.js
'use strict' | ||
const { inherits, format } = require('util') | ||
const { format } = require('util') | ||
function toString () { | ||
return `${this.name} [${this.code}]: ${this.message}` | ||
} | ||
function createError (code, message, statusCode = 500, Base = Error) { | ||
@@ -25,10 +29,15 @@ if (!code) throw new Error('Fastify error code must not be empty') | ||
FastifyError.prototype = Object.create(Base.prototype, { | ||
constructor: { | ||
value: FastifyError, | ||
enumerable: false, | ||
writable: true, | ||
configurable: true | ||
} | ||
}) | ||
FastifyError.prototype[Symbol.toStringTag] = 'Error' | ||
FastifyError.prototype.toString = function () { | ||
return `${this.name} [${this.code}]: ${this.message}` | ||
} | ||
FastifyError.prototype.toString = toString | ||
inherits(FastifyError, Base) | ||
return FastifyError | ||
@@ -35,0 +44,0 @@ } |
{ | ||
"name": "@fastify/error", | ||
"version": "3.2.1", | ||
"version": "3.3.0", | ||
"description": "A small utility, used by Fastify itself, for generating consistent error objects across your codebase and plugins.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
16697
295
0