Skip to content

Commit 26a2f1f

Browse files
committed
Improve error detection
1 parent bd2b221 commit 26a2f1f

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# 10.1.0
2+
3+
## Features
4+
5+
- Improve error detection using
6+
[`is-error-instance`](https://github.com/ehmicky/is-error-instance)
7+
18
# 10.0.0
29

310
## Package size

package-lock.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"test": "test"
4747
},
4848
"dependencies": {
49+
"is-error-instance": "^1.1.0",
4950
"is-plain-obj": "^4.1.0",
5051
"normalize-exception": "^2.7.0",
5152
"set-error-message": "^1.2.0"

src/repeat.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { inspect } from 'util'
22

3+
import isErrorInstance from 'is-error-instance'
4+
35
import { PREFIX } from './limit.js'
46

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

41-
const isErrorInstance = function (value) {
42-
return Object.prototype.toString.call(value) === '[object Error]'
43-
}
44-
4543
// We do not serialize `error.message` as it may contain dynamic values like
4644
// timestamps. This means errors are only `error.name` + `error.stack`, which
4745
// should be a good fingerprint.

0 commit comments

Comments
 (0)