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

defekt

Package Overview
Dependencies
Maintainers
3
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

defekt - npm Package Compare versions

Comparing version 6.0.0 to 6.0.1

7

CHANGELOG.md

@@ -0,1 +1,8 @@

## [6.0.1](https://github.com/thenativeweb/defekt/compare/6.0.0...6.0.1) (2020-11-26)
### Bug Fixes
* Add readme section regarding `isError`. ([#224](https://github.com/thenativeweb/defekt/issues/224)) ([ec995da](https://github.com/thenativeweb/defekt/commit/ec995da030e2e3707e3bcb216950d434d26c7189))
# [6.0.0](https://github.com/thenativeweb/defekt/compare/5.3.0...6.0.0) (2020-11-26)

@@ -2,0 +9,0 @@

4

package.json
{
"name": "defekt",
"version": "6.0.0",
"version": "6.0.1",
"description": "defekt is custom errors made simple.",

@@ -30,3 +30,3 @@ "contributors": [

"assertthat": "5.2.1",
"roboter": "11.5.13",
"roboter": "11.5.14",
"semantic-release-configuration": "1.0.28"

@@ -33,0 +33,0 @@ },

@@ -180,2 +180,22 @@ # defekt

### Recognizing JavaScript `Error`s
In addition to `CustomError`s and helpers related to those, `defekt` provides some tooling to work with native JavaScript `Error`s. Since TypeScript 4.0 caught exceptions can be annotated as `unknown` (see [Typescript 4.0 release notes](https://devblogs.microsoft.com/typescript/announcing-typescript-4-0/#unknown-on-catch)). Our [ESLint rules](https://github.com/thenativeweb/eslint-config-es) require us to use `unknown` over `any`, since it is more correct and defensive.
This requires developers to work with type guards to ensure that a caught error is actually an `Error`. Use `isError` for this:
```typescript
import { isError } from 'defekt';
try {
// ...
} catch (ex: unknown) {
if (!isError(ex)) {
// ex is unfortunately something really weird. You might want to get rid of whatever library is causing this.
throw ex;
}
// ...
}
```
## Running quality assurance

@@ -182,0 +202,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