Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 25, 2025. It is now read-only.
This repository was archived by the owner on Aug 25, 2025. It is now read-only.

Setting panic hook in initialization function causes wasm-pack to break #26

Open
Labels
bugSomething isn't working
@ThatNerdUKnow

Description

Describe the Bug

I'm defining my initalization function like so:

#[wasm_bindgen]
pub fn init() {
 #[cfg(feature = "console_error_panic_hook")]
 panic::set_hook(Box::new(console_error_panic_hook::hook));
 //set_panic_hook();
 wasm_logger::init(wasm_logger::Config::default());
}

This gives the following error when running wasm-pack build --release

thread 'main' panicked at 'assertion failed: `(left == right)`
 left: `"Error"`,
 right: `"Error2"`', crates\cli-support\src\js\mod.rs:175:21
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Error: Running the wasm-bindgen CLI
Caused by: Running the wasm-bindgen CLI
Caused by: failed to execute `wasm-bindgen`: exited with exit code: 101
 full command: "C:\\Users\\brand\\AppData\\Local\\.wasm-pack\\wasm-bindgen-7e757a9923d43b8a\\wasm-bindgen.exe" "C:\\Users\\brand\\repos\\celeste\\satellite-rs\\target\\wasm32-unknown-unknown\\release\\satellite_rs.wasm" "--out-dir" "C:\\Users\\brand\\repos\\celeste\\satellite-rs\\pkg" "--typescript" "--target" "bundler"

this error does not occur if I disable the "console_error_panic_hook" feature

Steps to Reproduce

  1. See error

Expected Behavior

I would expect that I would be able to create a wasm-bindgen function that I can call from my frontend to initalize the logging hook

Actual Behavior

Got the following error on wasm-pack build:

thread 'main' panicked at 'assertion failed: `(left == right)`
 left: `"Error"`,
 right: `"Error2"`', crates\cli-support\src\js\mod.rs:175:21
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Error: Running the wasm-bindgen CLI
Caused by: Running the wasm-bindgen CLI
Caused by: failed to execute `wasm-bindgen`: exited with exit code: 101
 full command: "C:\\Users\\brand\\AppData\\Local\\.wasm-pack\\wasm-bindgen-7e757a9923d43b8a\\wasm-bindgen.exe" "C:\\Users\\brand\\repos\\celeste\\satellite-rs\\target\\wasm32-unknown-unknown\\release\\satellite_rs.wasm" "--out-dir" "C:\\Users\\brand\\repos\\celeste\\satellite-rs\\pkg" "--typescript" "--target" "bundler"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /