From 37f6f92905511b252d3f026c38459408f34d47e9 Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Fri, 25 Feb 2022 16:20:51 -0500 Subject: [PATCH] errors: do not access .stack in debug Refs: #41541 PR-URL: https://github.com/nodejs/node/pull/42096 Refs: https://github.com/nodejs/node/issues/41541 Reviewed-By: Benjamin Gruenbaum Reviewed-By: Ruben Bridgewater Reviewed-By: Mestery --- lib/internal/source_map/prepare_stack_trace.js | 2 +- lib/internal/source_map/source_map_cache.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/internal/source_map/prepare_stack_trace.js b/lib/internal/source_map/prepare_stack_trace.js index 9492de2283322f..0635ee675418f5 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); } return `${str}${t}`; }), ''); diff --git a/lib/internal/source_map/source_map_cache.js b/lib/internal/source_map/source_map_cache.js index c0de6aeb51868f..e3721d024d9fb1 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); return; } const match = StringPrototypeMatch( @@ -119,7 +119,7 @@ function dataFromUrl(sourceURL, sourceMappingURL) { return null; } } catch (err) { - debug(err.stack); + debug(err); // 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); 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); return null; } } else {