From 5bf6008ca3573425ae407c2c31de25bfa99e4a6e Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Tue, 23 Jan 2024 23:43:55 -0800 Subject: [PATCH] Remove node 4 hack when assigning to `.stack`. NFC I verified we don't see any errors on the oldest version of node that we support (10.19.0) --- src/library_fs.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/library_fs.js b/src/library_fs.js index cca4d14a84550..91432691ad40a 100644 --- a/src/library_fs.js +++ b/src/library_fs.js @@ -1433,11 +1433,10 @@ FS.staticInit();` + #endif #if ASSERTIONS && !MINIMAL_RUNTIME - // Try to get a maximally helpful stack trace. On Node.js, getting Error.stack - // now ensures it shows what we want. + // Try to get a maximally helpful stack trace. if (this.stack) { - // Define the stack property for Node.js 4, which otherwise errors on the next line. - Object.defineProperty(this, "stack", { value: (new Error).stack, writable: true }); + // TODO(sbc): We can remove this if ErrnoError extends the Error class + this.stack = (new Error).stack; } #endif // ASSERTIONS };