Skip to content

Commit

Permalink
Update PanicHookInfo and fix initSync for current wasm-bindgen (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
shanemadden authored Dec 24, 2024
1 parent 2e2e6fb commit 2da85f9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion javascript/main.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { initSync, wasm_loop } from "./screeps-arena-starter-rust";
import wasm_bytes from "./screeps-arena-starter-rust_bg.wasm.bin";
initSync(wasm_bytes);
const wasm_module = new WebAssembly.Module(wasm_bytes);
initSync({ module: wasm_module });
export * from "./screeps-arena-starter-rust";

Error.stackTraceLimit = 100;
Expand Down
4 changes: 2 additions & 2 deletions src/logging.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::wasm_bindgen;
use core::panic::PanicInfo;
use std::panic::PanicHookInfo;
use js_sys::JsString;
use log::error;
pub use log::LevelFilter::*;
Expand Down Expand Up @@ -36,7 +36,7 @@ pub fn setup_logging(verbosity: log::LevelFilter) {
panic::set_hook(Box::new(panic_hook));
}

fn panic_hook(info: &PanicInfo) {
fn panic_hook(info: &PanicHookInfo) {
// import JS Error API to get backtrace info (backtraces don't work in wasm)
// Node 8 does support this API: https://nodejs.org/docs/latest-v8.x/api/errors.html#errors_error_stack

Expand Down

0 comments on commit 2da85f9

Please sign in to comment.