Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SM-1384] Fix panic on re-registering logger | WASM #935

Merged
merged 6 commits into from
Sep 12, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions crates/bitwarden-wasm/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,9 @@
#[wasm_bindgen(constructor)]
pub fn new(settings_input: Option<String>, log_level: Option<LogLevel>) -> Self {
console_error_panic_hook::set_once();
if let Err(e) =
console_log::init_with_level(convert_level(log_level.unwrap_or(LogLevel::Info)))
{
panic!("failed to initialize logger: {:?}", e);
}
// This will only fail if another logger was already initialized, so we can ignore the
// result.
let _ = console_log::init_with_level(convert_level(log_level.unwrap_or(LogLevel::Info)));

Check warning on line 42 in crates/bitwarden-wasm/src/client.rs

View check run for this annotation

Codecov / codecov/patch

crates/bitwarden-wasm/src/client.rs#L40-L42

Added lines #L40 - L42 were not covered by tests
Thomas-Avery marked this conversation as resolved.
Show resolved Hide resolved

Self(Rc::new(bitwarden_json::client::Client::new(settings_input)))
}
Expand Down
Loading