From 585c3599ab5fd3ec36c6ab6589e9289764eaa3b8 Mon Sep 17 00:00:00 2001 From: Akulij Date: Sun, 1 Jun 2025 13:53:29 +0500 Subject: [PATCH] exp --- src/bot_handler.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/bot_handler.rs b/src/bot_handler.rs index 96f56a7..b2be1a5 100644 --- a/src/bot_handler.rs +++ b/src/bot_handler.rs @@ -1,5 +1,5 @@ use log::{error, info}; -use quickjs_rusty::serde::to_js; +use quickjs_rusty::{serde::to_js, utils::get_exception}; use std::{ str::FromStr, sync::{Arc, Mutex, RwLock}, @@ -162,7 +162,13 @@ async fn handle_callback(bot: Bot, mut db: DB, bm: BotMessage, q: CallbackQuery) ); match handler.call_args(vec![]) { Ok(v) => { - println!("Ok branch, value: {:?}", v.js_to_string()); + // let ctx = quickjs_rusty::Context::from(value) + println!("Ok branch, value: {:?}", v); + if v.is_exception() { + let e = get_exception(v.context()); + println!("Exception: {e:?}"); + } + if v.is_bool() { v.to_bool().unwrap_or(true) } else if v.is_int() {