mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 05:10:03 -04:00
Log warning instead of error when failing to decode RON in storage (#2961)
* Log warning instead of error when failing to decode RON in storage * New web demo * Clean up some warn/error logging * Avoid deadlock that could happen on crash * Log errors using console.warn, because console.error can cause crashes * Use patched version of wasm-bindgen-cli, allowing >2GB memory * New web demo
This commit is contained in:
@@ -1051,7 +1051,13 @@ impl Storage for DummyStorage {
|
||||
pub fn get_value<T: serde::de::DeserializeOwned>(storage: &dyn Storage, key: &str) -> Option<T> {
|
||||
storage
|
||||
.get_string(key)
|
||||
.and_then(|value| ron::from_str(&value).ok())
|
||||
.and_then(|value| match ron::from_str(&value) {
|
||||
Ok(value) => Some(value),
|
||||
Err(err) => {
|
||||
log::warn!("Failed to decode RON: {err}");
|
||||
None
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/// Serialize the given value as [RON](https://github.com/ron-rs/ron) and store with the given key.
|
||||
|
||||
Reference in New Issue
Block a user