MCPcopy Create free account
hub / github.com/nodejs/node / CheckStackTrace

Function CheckStackTrace

deps/v8/test/mjsunit/wasm/imported-dataview.js:199–226  ·  view source on GitHub ↗
(thrower, reference, topmost_wasm_func)

Source from the content-addressed store, hash-verified

197}
198
199function CheckStackTrace(thrower, reference, topmost_wasm_func) {
200 let reference_exception;
201 let actual_exception;
202 try {
203 thrower();
204 assertUnreachable();
205 } catch (e) {
206 actual_exception = e;
207 }
208 try {
209 reference();
210 assertUnreachable();
211 } catch (e) {
212 reference_exception = e;
213 }
214 assertInstanceof(actual_exception, reference_exception.constructor);
215 let actual_stack = actual_exception.stack.split('\n');
216 let reference_stack = reference_exception.stack.split('\n');
217 assertEquals(reference_stack[0], actual_stack[0]);
218 assertEquals(reference_stack[1], actual_stack[1]);
219
220 let str_stack_msg = ` at ${topmost_wasm_func} (wasm://wasm/`;
221 if (!actual_stack[2].startsWith(str_stack_msg)) {
222 console.log(
223 `expected starts with:\n${str_stack_msg}\nfound:\n${actual_stack[2]}`);
224 assertUnreachable();
225 }
226}
227
228function CheckDataViewErrorMessages(
229 dataview_op, array, detach_check, set_to_value) {

Callers 2

Calls 6

assertUnreachableFunction · 0.85
assertInstanceofFunction · 0.85
throwerFunction · 0.50
assertEqualsFunction · 0.50
splitMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected