Skip to content

Commit

Permalink
errors: do not access .stack in debug
Browse files Browse the repository at this point in the history
Refs: #41541
  • Loading branch information
bcoe committed Feb 23, 2022
1 parent a07757d commit c1275f8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/internal/source_map/prepare_stack_trace.js
Expand Up @@ -106,7 +106,7 @@ const prepareStackTrace = (globalThis, error, trace) => {
}
}
} catch (err) {
debug(err.stack);
debug(err.message);
}
return `${str}${t}`;
}), '');
Expand Down Expand Up @@ -187,7 +187,7 @@ function getOriginalSource(payload, originalSourcePath) {
try {
source = readFileSync(originalSourcePathNoScheme, 'utf8');
} catch (err) {
debug(err);
debug(err.message);
source = '';
}
}
Expand Down
8 changes: 4 additions & 4 deletions lib/internal/source_map/source_map_cache.js
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.message);
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.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);
Expand All @@ -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;
}
}
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.message);
return null;
}
} else {
Expand Down

0 comments on commit c1275f8

Please sign in to comment.