MCPcopy Index your code
hub / github.com/JS-DevTools/ono / createFakeStack

Function createFakeStack

test/utils/create-fake-stack.js:15–32  ·  view source on GitHub ↗

* Creates a fake error stack, based on the current host environment. * * @param {...{ fn: string, file: string, line: number, col: number }} entries * An array of fake stack entries * * @returns {string}

(...entries)

Source from the content-addressed store, hash-verified

13 * @returns {string}
14 */
15function createFakeStack (...entries) {
16 let stack = "";
17
18 if (host.error.stack.includesErrorMessage) {
19 stack += "Error: This is a fake error\n";
20 }
21
22 for (let { fn, file, line, col } of entries) {
23 if (host.browser.firefox || host.browser.safari) {
24 stack += `${fn}@${file}:${line}:${col}\n`;
25 }
26 else {
27 stack += ` at ${fn} (${file}:${line}:${col})\n`;
28 }
29 }
30
31 return stack;
32}

Callers 2

constructorMethod · 0.85
makeNonErrorFunction · 0.85

Calls

no outgoing calls

Tested by 2

constructorMethod · 0.68
makeNonErrorFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…