Skip to content

Commit f6fe588

Browse files
fix(pouchdb-errors): guard Error.stack access in restricted environments
1 parent c9e4731 commit f6fe588

File tree

1 file changed

+4
-6
lines changed
  • packages/node_modules/pouchdb-errors/src

1 file changed

+4
-6
lines changed

packages/node_modules/pouchdb-errors/src/index.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,11 @@ function generateErrorFromResponse(err) {
9292
err.message = err.message || err.reason;
9393
}
9494

95-
try {
96-
if (!('stack' in err)) {
97-
err.stack = (new Error()).stack;
95+
try {
96+
err && err.stack;
97+
} catch (e) {
98+
// ignore environments where stack access throws
9899
}
99-
} catch (e) {
100-
err.stack = 'No stack trace available';
101-
}
102100

103101
return err;
104102
}

0 commit comments

Comments
 (0)