Skip to content

Commit

Permalink
errors: do not access .stack in debug
Browse files Browse the repository at this point in the history
Refs: nodejs#41541

PR-URL: nodejs#42096
Refs: nodejs#41541
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Mestery <mestery@protonmail.com>
  • Loading branch information
bcoe authored and sxa committed Mar 7, 2022
1 parent ec4c0de commit 2e1231b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/internal/source_map/prepare_stack_trace.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ const prepareStackTrace = (globalThis, error, trace) => {
}
}
} catch (err) {
debug(err.stack);
debug(err);
}
return `${str}${t}`;
}), '');
Expand Down
8 changes: 4 additions & 4 deletions lib/internal/source_map/source_map_cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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);
Expand All @@ -144,7 +144,7 @@ function sourceMapFromFile(mapURL) {
const data = JSONParse(content);
return sourcesToAbsolute(mapURL, data);
} catch (err) {
debug(err.stack);
debug(err);
return null;
}
}
Expand All @@ -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 {
Expand Down

0 comments on commit 2e1231b

Please sign in to comment.