diff --git a/Cargo.lock b/Cargo.lock index 4f3a103..f0e7373 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1179,7 +1179,7 @@ checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "rkgk" -version = "0.1.1" +version = "0.2.0" dependencies = [ "argon2", "axum", diff --git a/crates/haku-wasm/src/lib.rs b/crates/haku-wasm/src/lib.rs index 7697a2e..5f37ab5 100644 --- a/crates/haku-wasm/src/lib.rs +++ b/crates/haku-wasm/src/lib.rs @@ -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; diff --git a/crates/rkgk/Cargo.toml b/crates/rkgk/Cargo.toml index 71b3057..c5622e2 100644 --- a/crates/rkgk/Cargo.toml +++ b/crates/rkgk/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rkgk" -version = "0.1.1" +version = "0.2.0" edition = "2021" [dependencies] diff --git a/crates/rkgk/src/main.rs b/crates/rkgk/src/main.rs index b322b18..c29bcce 100644 --- a/crates/rkgk/src/main.rs +++ b/crates/rkgk/src/main.rs @@ -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; diff --git a/static/painter.js b/static/painter.js index cf52dc3..6895047 100644 --- a/static/painter.js +++ b/static/painter.js @@ -4,6 +4,8 @@ export class Painter { } renderBrushToWall(haku, centerX, centerY, wall) { + haku.resetVm(); + let evalResult = haku.evalBrush(); if (evalResult.status != "ok") return { status: "error", phase: "eval", result: evalResult }; @@ -23,12 +25,10 @@ export class Painter { let renderResult = haku.renderValue(chunk.pixmap, x, y); if (renderResult.status != "ok") { - haku.resetVm(); return { status: "error", phase: "render", result: renderResult }; } } } - haku.resetVm(); for (let y = topChunk; y < bottomChunk; ++y) { for (let x = leftChunk; x < rightChunk; ++x) {