MCPcopy Create free account
hub / github.com/Kong/insomnia / evalOrThrow

Function evalOrThrow

packages/insomnia/src/scripting/quickjs-script-engine.ts:414–424  ·  view source on GitHub ↗
(vm: QuickJSContext, code: string, filename: string)

Source from the content-addressed store, hash-verified

412};
413
414const evalOrThrow = (vm: QuickJSContext, code: string, filename: string): void => {
415 const result = vm.evalCode(code, filename);
416 if (result.error) {
417 const errData = vm.dump(result.error);
418 result.error.dispose();
419 throw toError(errData);
420 }
421 if ('value' in result) {
422 result.value.dispose();
423 }
424};
425
426/** Drives `globalThis.__task` (a VM promise wrapping the user script) to completion. */
427const driveTaskToCompletion = async (vm: QuickJSContext, deadline: number, timeoutMs: number): Promise<void> => {

Callers 1

runScriptInQuickJsFunction · 0.70

Calls 1

toErrorFunction · 0.70

Tested by

no test coverage detected