Closed DraftedDev closed 1 year ago
Hi, looking at your code it seems you build a context without the ability to evaluate code.
Context::builder
by default does not able any intrisics, use ContextBuilder::with
If you want to run javascript code from source you need to enable at least the intrisic Eval
and probably also BaseObjects
. Otherwise the context is only able to run code already compiled into bytecode.
The reason the error message is so short is because QuickJS doesn't return an error message in this case and just returns an exception
WOW! That helped!
Thanks 👍 for your help and developing this crate!
Hi, I recently stumbled upon this great library, however my code fails with a weird exception. My cargo dependency looks like this:
rquickjs = { git = "https://github.com/DelSkayn/rquickjs.git", features = ["smol", "macro", "parallel", "dyn-load", "loader"] }
I have this code:
When running this, rust compiles, but generates a runtime error that says "Exception generated by quickjs". Seems to have something to do with .eval_file().
NOTE: The ../scripts/script.js file DOES exist in the RIGHT location and contains nothing at all (empty file).
Anyone know what exactly is failing and how to fix it? Also more detailed QuickJS Errors would be cool. Thanks 😄