Skip to content

Commit

Permalink
Ignore errors on thisValue property accesses
Browse files Browse the repository at this point in the history
  • Loading branch information
flotwig authored and mroderick committed Feb 19, 2020
1 parent 8c8336c commit a49167c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/sinon/util/core/function-to-string.js
Expand Up @@ -8,9 +8,14 @@ module.exports = function toString() {
while (i--) {
thisValue = this.getCall(i).thisValue;

// eslint-disable-next-line guard-for-in
for (prop in thisValue) {
if (thisValue[prop] === this) {
return prop;
try {
if (thisValue[prop] === this) {
return prop;
}
} catch (e) {
// no-op - accessing props can throw an error, nothing to do here
}
}
}
Expand Down

0 comments on commit a49167c

Please sign in to comment.