wasm: Enable console.error() panic hook

Makes debugging a little bit easier...
This commit is contained in:
Pekka Enberg
2024-08-04 09:45:27 +03:00
parent e5034acb9e
commit 7df979cd3a
3 changed files with 17 additions and 0 deletions

11
Cargo.lock generated
View File

@@ -392,6 +392,16 @@ dependencies = [
"crossbeam-utils",
]
[[package]]
name = "console_error_panic_hook"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc"
dependencies = [
"cfg-if",
"wasm-bindgen",
]
[[package]]
name = "core-foundation-sys"
version = "0.8.6"
@@ -1041,6 +1051,7 @@ dependencies = [
name = "limbo-wasm"
version = "0.0.3"
dependencies = [
"console_error_panic_hook",
"limbo_core",
"wasm-bindgen",
]

View File

@@ -11,5 +11,6 @@ crate-type = ["cdylib"]
path = "lib.rs"
[dependencies]
console_error_panic_hook = "0.1.7"
limbo_core = { path = "../../core", default-features = false }
wasm-bindgen = "0.2"

View File

@@ -75,3 +75,8 @@ impl limbo_core::Wal for Wal {
todo!()
}
}
#[wasm_bindgen(start)]
pub fn init() {
console_error_panic_hook::set_once();
}