fix haku-wasm/haku.js errors not resetting properly sometimes
This commit is contained in:
parent
59a6bda0ba
commit
ba89b6eb04
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -1179,7 +1179,7 @@ checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b"
|
|||
|
||||
[[package]]
|
||||
name = "rkgk"
|
||||
version = "0.1.1"
|
||||
version = "0.2.0"
|
||||
dependencies = [
|
||||
"argon2",
|
||||
"axum",
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "rkgk"
|
||||
version = "0.1.1"
|
||||
version = "0.2.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue