AV6A
Deno3y ago
AV6

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.
   
 }
 

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?
Was this page helpful?