AV6
AV6
DDeno
Created by AV6 on 2/2/2024 in #help
deno runtime extensions seems to be not working
the example provided here https://github.com/denoland/deno/tree/main/runtime/examples/extension_with_esm seems to be not working. when the js file is executed, i get an error Error: TypeError: Deno[Deno.internal].core.opSync is not a function. what changed, i am able to register an extension with JsRuntime directly but not through workerOptions. wondering how to fix this. How do we access the extension ops from the js side in the latest version?
2 replies
DDeno
Created by AV6 on 7/26/2023 in #help
rusty_v8 extracting stack trace when a promise rejects
Hi, i am trying to get the stack trace and print it out when a promise rejects.
if promise.state() == v8::PromiseState::Rejected {
let exception = promise.result(scope);
retval = exception.to_rust_string_lossy(scope);

if exception.is_native_error() {
//how to get the exception stack trace to print here?
// i have retval from above, but it is just the oneliner eg:TypeError: Assignment to constant variable.

}

if promise.state() == v8::PromiseState::Rejected {
let exception = promise.result(scope);
retval = exception.to_rust_string_lossy(scope);

if exception.is_native_error() {
//how to get the exception stack trace to print here?
// i have retval from above, but it is just the oneliner eg:TypeError: Assignment to constant variable.

}

in the above example, i have the retval as the exception string which contains something like TypeError: Assignment to constant variable.. But how do i extract exception stack trace and get the line number and other details as well from this?
4 replies
DDeno
Created by AV6 on 6/30/2023 in #help
calling a javascript function and waiting for the promise with `rusty_v8`
let result = function.call(scope, recv, &[]).expect("couldnt run");
/*i got this result which is a promise. now how do i get the value of the promise

let value = ??
*/
let result = function.call(scope, recv, &[]).expect("couldnt run");
/*i got this result which is a promise. now how do i get the value of the promise

let value = ??
*/
result.is_promise is true promise state is Pending scope.has_pending_background_tasks() is false which confuses me. Isnt this supposed to be true if there are unresolved promises?
21 replies