Socket
Socket
Sign inDemoInstall

@cdellacqua/serializable-error

Package Overview
Dependencies
0
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @cdellacqua/serializable-error

Custom error class that supports JSON serialization and concatenation


Version published
Weekly downloads
14
decreased by-50%
Maintainers
1
Install size
9.18 kB
Created
Weekly downloads
 

Readme

Source

serializable-error

Custom error class that supports JSON serialization and concatenation

NPM Package

npm install @cdellacqua/serializable-error

Full documentation:

Highlights

Keep track of what caused the error

try {
	someFunctionThatThrows();
} catch (err) {
	// some error handling logic
	// ...
	throw new SerializableError('something more specific about the current exception', err);
}

Exception logging

try {
	someFunctionThatThrows();
} catch (err) {
	logger.log(SerializableError.from(err));
	// or, if it only accepts strings
	logger.log(JSON.stringify(SerializableError.from(err)));
	throw err;
}

Keywords

FAQs

Last updated on 07 Aug 2021

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.

Install

Related posts

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