MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / parseStackTrace

Function parseStackTrace

webview-ui/src/utils/sourceMapUtils.ts:169–190  ·  view source on GitHub ↗
(stack: string)

Source from the content-addressed store, hash-verified

167 * This is kept for backward compatibility with tests
168 */
169export async function parseStackTrace(stack: string): Promise<any[]> {
170 if (!stack) return []
171
172 try {
173 // Create a temporary Error object with the provided stack
174 const tempError = new Error()
175 tempError.stack = stack
176
177 // Use StackTrace.js to parse the stack
178 const frames = await StackTrace.fromError(tempError)
179 return frames.map((frame: StackTrace.StackFrame) => ({
180 functionName: frame.functionName || "<anonymous>",
181 fileName: frame.fileName,
182 lineNumber: frame.lineNumber,
183 columnNumber: frame.columnNumber,
184 source: `at ${frame.functionName || "<anonymous>"} (${frame.fileName}:${frame.lineNumber}:${frame.columnNumber})`,
185 }))
186 } catch (error) {
187 console.error("Error parsing stack trace with StackTrace.js:", error)
188 return [] // Return empty array if parsing fails
189 }
190}

Callers 1

Calls 1

errorMethod · 0.65

Tested by

no test coverage detected