error-custom-class
Advanced tools
Comparing version 6.0.0 to 7.0.0
@@ -27,7 +27,6 @@ import type { ErrorName, ErrorParams } from 'error-class-utils' | ||
* try { | ||
* throw new UserError('message', { props: { userId: 56 } }) | ||
* throw new UserError('message') | ||
* } catch (error) { | ||
* console.log(error.name) // 'UserError' | ||
* console.log(error instanceof UserError) // true | ||
* console.log(error.userId) // 56 | ||
* } | ||
@@ -34,0 +33,0 @@ * ``` |
import{ | ||
ponyfillCause, | ||
ensureCorrectClass, | ||
setErrorName, | ||
sanitizeProperties}from | ||
setErrorName}from | ||
"error-class-utils"; | ||
@@ -22,5 +21,2 @@ | ||
ponyfillCause(this,parameters); | ||
const props=sanitizeProperties(parameters===null||parameters===void 0?void 0:parameters.props); | ||
Object.assign(this,props); | ||
}}; | ||
@@ -27,0 +23,0 @@ |
{ | ||
"name": "error-custom-class", | ||
"version": "6.0.0", | ||
"version": "7.0.0", | ||
"type": "module", | ||
@@ -49,3 +49,4 @@ "exports": "./build/src/main.js", | ||
"dependencies": { | ||
"error-class-utils": "^1.0.0" | ||
"error-class-utils": "^2.0.0", | ||
"set-error-props": "^3.0.0" | ||
}, | ||
@@ -52,0 +53,0 @@ "devDependencies": { |
@@ -12,3 +12,2 @@ [![Codecov](https://img.shields.io/codecov/c/github/ehmicky/error-custom-class.svg?label=tested&logo=codecov)](https://codecov.io/gh/ehmicky/error-custom-class) | ||
- [Very simple API](#api) | ||
- Error properties are [set on initialization](#example) | ||
- Ponyfill | ||
@@ -18,5 +17,2 @@ [`error.cause`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause) | ||
[older Node.js and browsers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause#browser_compatibility) | ||
- Prevent | ||
[prototype pollution](https://github.com/ehmicky/error-class-utils#sanitizepropertiesproperties) | ||
when setting error properties | ||
- Properly | ||
@@ -37,7 +33,6 @@ [set `error.name`](https://github.com/ehmicky/error-class-utils#seterrornameerrorclass-name) | ||
try { | ||
throw new UserError('message', { props: { userId: 56 } }) | ||
throw new UserError('message') | ||
} catch (error) { | ||
console.log(error.name) // 'UserError' | ||
console.log(error instanceof UserError) // true | ||
console.log(error.userId) // 56 | ||
} | ||
@@ -44,0 +39,0 @@ ``` |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
18912
2
49
115
+ Addedset-error-props@^3.0.0
+ Addederror-class-utils@2.5.0(transitive)
+ Addedis-error-instance@1.6.0(transitive)
+ Addedis-plain-obj@4.1.0(transitive)
+ Addedset-error-props@3.5.0(transitive)
- Removederror-class-utils@1.0.0(transitive)
Updatederror-class-utils@^2.0.0