Skip to content

evalCode won't return error in ES module mode #160

@yar2001

Description

@yar2001

Thanks so much for this project!

Bug

Starting from version 0.28.0, when evaluating code as an ES module, evalCode won't return the error.

For example, the result won't have an error prop in the following code (test in browser):

import { getQuickJS } from 'quickjs-emscripten'; async function main() { const QuickJS = await getQuickJS(); const vm = QuickJS.newContext(); const world = vm.newString('world'); vm.setProp(vm.global, 'NAME', world); world.dispose(); const result = vm.evalCode(`(null).abc;"Hello " + NAME + "!"`, '', { strict: true, type: 'module', }); if (result.error) { console.log('Execution failed:', vm.dump(result.error)); result.error.dispose(); } else { console.log('Success:', vm.dump(result.value)); result.value.dispose(); } vm.dispose(); }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions