Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export kSymbolPrepareStackTrace #79

Merged
merged 1 commit into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions js/stack-trace/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,15 @@ function getPrepareStackTrace (originalPrepareStackTrace) {

const wrappedPrepareStackTrace = (error, structuredStackTrace) => {
if (originalPrepareStackTrace) {
const parsedCallSites = structuredStackTrace.map((callSite) => new WrappedCallSite(callSite))
let parsedCallSites
try {
parsedCallSites = structuredStackTrace.map((callSite) => new WrappedCallSite(callSite))
} catch (e) {
parsedCallSites = structuredStackTrace
}
return originalPrepareStackTrace(error, parsedCallSites)
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idk if it would be interesting to protect the next part...

const stackLines = error.stack.split('\n')
let firstIndex = -1
for (let i = 0; i < stackLines.length; i++) {
Expand Down Expand Up @@ -138,5 +144,6 @@ function getPrepareStackTrace (originalPrepareStackTrace) {
}

module.exports = {
getPrepareStackTrace
getPrepareStackTrace,
kSymbolPrepareStackTrace
}
5 changes: 3 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2022 Datadog, Inc.
**/
'use strict'
const { getPrepareStackTrace } = require('./js/stack-trace/')
const { getPrepareStackTrace, kSymbolPrepareStackTrace } = require('./js/stack-trace/')
const { cacheRewrittenSourceMap, getOriginalPathAndLineFromSourceMap } = require('./js/source-map')

class DummyRewriter {
Expand Down Expand Up @@ -80,5 +80,6 @@ module.exports = {
Rewriter: getRewriter(),
DummyRewriter,
getPrepareStackTrace,
getOriginalPathAndLineFromSourceMap
getOriginalPathAndLineFromSourceMap,
kSymbolPrepareStackTrace
}
Loading