MCPcopy Create free account
hub / github.com/mscdex/ssh2 / getCallSite

Function getCallSite

test/common.js:87–98  ·  view source on GitHub ↗
(top)

Source from the content-addressed store, hash-verified

85}
86
87function getCallSite(top) {
88 const originalStackFormatter = Error.prepareStackTrace;
89 Error.prepareStackTrace = (err, stack) =>
90 `${stack[0].getFileName()}:${stack[0].getLineNumber()}`;
91 const err = new Error();
92 Error.captureStackTrace(err, top);
93 // With the V8 Error API, the stack is not formatted until it is accessed
94 // eslint-disable-next-line no-unused-expressions
95 err.stack;
96 Error.prepareStackTrace = originalStackFormatter;
97 return err.stack;
98}
99
100function mustNotCall(msg) {
101 const callSite = getCallSite(mustNotCall);

Callers 1

mustNotCallFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…