From c1275f8dcceedcba4320e4b8c5424ba7586437e7 Mon Sep 17 00:00:00 2001 From: "bencoe@google.com" Date: Wed, 23 Feb 2022 17:24:15 +0000 Subject: [PATCH] errors: do not access .stack in debug Refs: #41541 --- lib/internal/source_map/prepare_stack_trace.js | 4 ++-- lib/internal/source_map/source_map_cache.js | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/internal/source_map/prepare_stack_trace.js b/lib/internal/source_map/prepare_stack_trace.js index 9492de2283322f..a47726f0dba55e 100644 --- a/lib/internal/source_map/prepare_stack_trace.js +++ b/lib/internal/source_map/prepare_stack_trace.js @@ -106,7 +106,7 @@ const prepareStackTrace = (globalThis, error, trace) => { } } } catch (err) { - debug(err.stack); + debug(err.message); } return `${str}${t}`; }), ''); @@ -187,7 +187,7 @@ function getOriginalSource(payload, originalSourcePath) { try { source = readFileSync(originalSourcePathNoScheme, 'utf8'); } catch (err) { - debug(err); + debug(err.message); source = ''; } } diff --git a/lib/internal/source_map/source_map_cache.js b/lib/internal/source_map/source_map_cache.js index c0de6aeb51868f..42b9231b89aca9 100644 --- a/lib/internal/source_map/source_map_cache.js +++ b/lib/internal/source_map/source_map_cache.js @@ -79,7 +79,7 @@ function maybeCacheSourceMap(filename, content, cjsModuleInstance) { } catch (err) { // This is most likely an [eval]-wrapper, which is currently not // supported. - debug(err.stack); + debug(err.message); return; } const match = StringPrototypeMatch( @@ -119,7 +119,7 @@ function dataFromUrl(sourceURL, sourceMappingURL) { return null; } } catch (err) { - debug(err.stack); + debug(err.message); // If no scheme is present, we assume we are dealing with a file path. const mapURL = new URL(sourceMappingURL, sourceURL).href; return sourceMapFromFile(mapURL); @@ -144,7 +144,7 @@ function sourceMapFromFile(mapURL) { const data = JSONParse(content); return sourcesToAbsolute(mapURL, data); } catch (err) { - debug(err.stack); + debug(err.message); return null; } } @@ -163,7 +163,7 @@ function sourceMapFromDataUrl(sourceURL, url) { const parsedData = JSONParse(decodedData); return sourcesToAbsolute(sourceURL, parsedData); } catch (err) { - debug(err.stack); + debug(err.message); return null; } } else {