Skip to content

Commit

Permalink
Improve error detection
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Oct 9, 2022
1 parent bd2b221 commit 26a2f1f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 10.1.0

## Features

- Improve error detection using
[`is-error-instance`](https://github.com/ehmicky/is-error-instance)

# 10.0.0

## Package size
Expand Down
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"test": "test"
},
"dependencies": {
"is-error-instance": "^1.1.0",
"is-plain-obj": "^4.1.0",
"normalize-exception": "^2.7.0",
"set-error-message": "^1.2.0"
Expand Down
6 changes: 2 additions & 4 deletions src/repeat.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { inspect } from 'util'

import isErrorInstance from 'is-error-instance'

import { PREFIX } from './limit.js'

// Duplicate errors are only logged once because:
Expand Down Expand Up @@ -38,10 +40,6 @@ const getPreviousEvent = function (value) {
return previousEvent.slice(0, FINGERPRINT_MAX_LENGTH)
}

const isErrorInstance = function (value) {
return Object.prototype.toString.call(value) === '[object Error]'
}

// We do not serialize `error.message` as it may contain dynamic values like
// timestamps. This means errors are only `error.name` + `error.stack`, which
// should be a good fingerprint.
Expand Down

0 comments on commit 26a2f1f

Please sign in to comment.