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

new-error

Package Overview
Dependencies
Maintainers
2
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

new-error - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

6

CHANGELOG.md

@@ -0,1 +1,7 @@

## 1.0.7 - Sat May 16 2020 00:05:10
**Contributor:** Theo Gravity
- Update readme with use-cases
## 1.0.6 - Fri May 15 2020 23:34:12

@@ -2,0 +8,0 @@

2

package.json
{
"name": "new-error",
"version": "1.0.6",
"version": "1.0.7",
"description": "A production-grade error creation and serialization library designed for Typescript",

@@ -5,0 +5,0 @@ "main": "build/index.js",

@@ -24,2 +24,3 @@ # new-error

<!-- TOC -->
- [Motivation / Error handling use-cases](#motivation--error-handling-use-cases)
- [Installation](#installation)

@@ -51,2 +52,19 @@ - [Example Usage](#example-usage)

# Motivation / Error handling use-cases
The basic Javascript `Error` type is extremely bare bones - you can only specify a message.
In a production-level application, I've experienced the following use-cases:
- A developer should be able to add metadata to the error that may assist with troubleshooting.
- A developer should be able to reference the original error.
- Errors should be able to work with a logging framework.
- Errors should be well-formed / have a defined structure that can be consumed / emitted for analytics and services.
- Errors should not expose sensitive data to the end-user / client.
- Errors that are exposed to the end-user / client should not reveal data that would expose system internals.
- Error responses from an API service should follow a common format.
- End-users / clients should be able to relay the error back to support; the relayed data should be enough for a developer to troubleshoot.
`new-error` was built with these use-cases in mind.
# Installation

@@ -496,2 +514,10 @@

}
// You'll need to modify code below to best fit your use-case
// err.message could potentially expose system internals
return res.json({
err: {
message: err.message
}
})
}

@@ -498,0 +524,0 @@

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