fix haku-wasm/haku.js errors not resetting properly sometimes

This commit is contained in:
りき萌 2024-08-24 18:40:16 +02:00
parent 59a6bda0ba
commit ba89b6eb04
5 changed files with 10 additions and 4 deletions

View file

@ -410,9 +410,12 @@ unsafe extern "C" fn haku_eval_brush(instance: *mut Instance, brush: *const Brus
return StatusCode::OutOfRefSlots;
};
debug!("resetting exception");
instance.exception = None;
instance.value = match instance.vm.run(&instance.system, closure_id) {
Ok(value) => value,
Err(exn) => {
debug!("setting exception {exn:?}");
instance.exception = Some(exn);
return StatusCode::EvalException;
}
@ -429,6 +432,8 @@ unsafe extern "C" fn haku_render_value(
translation_y: f32,
) -> StatusCode {
let instance = &mut *instance;
debug!("resetting exception");
instance.exception = None;
let pixmap_locked = &mut (*pixmap).pixmap;

View file

@ -1,6 +1,6 @@
[package]
name = "rkgk"
version = "0.1.1"
version = "0.2.0"
edition = "2021"
[dependencies]

View file

@ -7,6 +7,7 @@ use std::{
use api::Api;
use axum::Router;
use color_eyre::owo_colors::OwoColorize;
use config::Config;
use copy_dir::copy_dir;
use eyre::Context;