MCPcopy Create free account
hub / github.com/JS-DevTools/ono / makeError

Function makeError

test/specs/stack.spec.js:123–148  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

121
122 it("should lazily pop Ono off the new error's stack", () => {
123 function makeError () {
124 class MyCustomError extends Error {
125 constructor (message) {
126 super(message);
127
128 delete this.stack;
129 let stack = createFakeStack(
130 { fn: "foo", file: "foo.js", line: 1, col: 1 },
131 { fn: "bar", file: "bar.js", line: 100, col: 100 },
132 );
133
134 this.stackHasBeenRead = false;
135
136 Object.defineProperty(this, "stack", {
137 configurable: true,
138 get () {
139 this.stackHasBeenRead = true;
140 return stack;
141 },
142 });
143 }
144 }
145
146 let myCustomOno = new Ono(MyCustomError);
147 return myCustomOno("Oops, an error happened.");
148 }
149
150 let error = makeError();
151

Callers 1

stack.spec.jsFile · 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…