Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
errors: support possible deletion of globalThis.Error
Do not crash trying to access prepareStackTrace on `undefined`.
  • Loading branch information
targos committed Oct 4, 2020
commit de9118b8706141eb81ccb837bfbca04a481f02b9
2 changes: 1 addition & 1 deletion lib/internal/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const maybeOverridePrepareStackTrace = (globalThis, error, trace) => {
// https://crbug.com/v8/7848
// `globalThis` is the global that contains the constructor which
// created `error`.
if (typeof globalThis.Error.prepareStackTrace === 'function') {
if (typeof globalThis.Error?.prepareStackTrace === 'function') {
return globalThis.Error.prepareStackTrace(error, trace);
}
// We still have legacy usage that depends on the main context's `Error`
Expand Down