
Security News
Feross on TBPN: How North Korea Hijacked Axios
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.
stringifiable-error
Advanced tools
Allow instances of Error to be serialized implicitly by JSON.stringify()
Enhances Error.prototype with a toJSON() method so that errors can be
serialized without explicit transformation.
npm install stringifiable-error
You only need to import (or require()) 'stringifiable-error' for its side
effects once, typically in the primary entry point to your program.
import 'stringifiable-error'
Then, wherever you need to serialize an error, JSON.stringify() will work.
try {
// ...
} catch (error) {
// `logger` serializes `error` before saving it.
logger.error(error)
}
// The serialized error:
//
// {
// "type": "AssertionError",
// "message": "`3 + 5` is `7`",
// "stack": [
// "fn (/.../src/client.ts:35:3)",
// "Object.<anonymous> (/.../src/client.ts:40:3)",
// "Module._compile (module.js:649:30)",
// "Module.m._compile (/.../node_modules/ts-node/src/index.ts:403:23)",
// "Module._extensions..js (module.js:660:10)",
// "Object.require.extensions.(anonymous function) [as .ts] (/.../node_modules/ts-node/src/index.ts:406:12)",
// "Module.load (module.js:561:32)",
// "tryModuleLoad (module.js:501:12)",
// "Function.Module._load (module.js:493:3)",
// "Function.Module.runMain (module.js:690:10)"
// ],
// "actual": false,
// "code": "ERR_ASSERTION",
// "expected": true,
// "generatedMessage": false,
// "name": "AssertionError [ERR_ASSERTION]",
// "operator": "=="
// }
FAQs
Allow instances of Error to be serialized implicitly by JSON.stringify()
The npm package stringifiable-error receives a total of 2 weekly downloads. As such, stringifiable-error popularity was classified as not popular.
We found that stringifiable-error demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.

Security News
OpenSSF has issued a high-severity advisory warning open source developers of an active Slack-based campaign using impersonation to deliver malware.

Research
/Security News
Malicious packages published to npm, PyPI, Go Modules, crates.io, and Packagist impersonate developer tooling to fetch staged malware, steal credentials and wallets, and enable remote access.