MCPcopy Create free account
hub / github.com/deepnote/vscode-deepnote / serializeStackTrace

Function serializeStackTrace

src/platform/errors/index.ts:63–79  ·  view source on GitHub ↗
(ex: Error)

Source from the content-addressed store, hash-verified

61}
62
63function serializeStackTrace(ex: Error): string {
64 // We aren't showing the error message (ex.message) since it might contain PII.
65 let trace = '';
66 for (const frame of parseStack(ex)) {
67 const filename = frame.getFileName();
68 if (filename) {
69 const lineno = frame.getLineNumber();
70 const colno = frame.getColumnNumber();
71 trace += `\n\tat ${getCallSite(frame)} ${filename}:${lineno}:${colno}`;
72 } else {
73 trace += '\n\tat <anonymous>';
74 }
75 }
76 // Ensure we always use `/` as path separators.
77 // This way stack traces (with relative paths) coming from different OS will always look the same.
78 return trace.trim().replace(/\\/g, '/');
79}
80
81function getCallSite(frame: stackTrace.StackFrame) {
82 const parts: string[] = [];

Callers 1

Calls 3

parseStackFunction · 0.85
getCallSiteFunction · 0.85
replaceMethod · 0.45

Tested by

no test coverage detected