log parse errors
This commit is contained in:
1 parent
f132a08f7d
commit
586983291a
3 files changed
+19
-11
No files matched your search
@@ -81,13 +81,16 @@ impl DesktopController {
|
|||||||
impl ErrorHandler for DesktopErrorHandler {
|
impl ErrorHandler for DesktopErrorHandler {
|
||||||
fn handle_error(&self, err: Error) {
|
fn handle_error(&self, err: Error) {
|
||||||
if let Some(conn) = &mut *self.latest_connection.lock().unwrap() {
|
if let Some(conn) = &mut *self.latest_connection.lock().unwrap() {
|
||||||
if let Error::RecompileRequiredError(reason) = err {
|
match err {
|
||||||
conn.get_mut()
|
Error::RecompileRequiredError(reason) => {
|
||||||
.write_all(
|
conn.get_mut()
|
||||||
(serde_json::to_string(&reason).unwrap() + "\n")
|
.write_all(
|
||||||
.as_bytes(),
|
(serde_json::to_string(&reason).unwrap() + "\n")
|
||||||
)
|
.as_bytes(),
|
||||||
.unwrap();
|
)
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
|
Error::ParseError(err) => log::warn!("{}", err),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ features = [
|
|||||||
[features]
|
[features]
|
||||||
default = ["panic_hook"]
|
default = ["panic_hook"]
|
||||||
panic_hook = ["console_error_panic_hook"]
|
panic_hook = ["console_error_panic_hook"]
|
||||||
hot_reload = ["dioxus-rsx-interpreter", "web-sys/WebSocket", "web-sys/Location", "web-sys/MessageEvent", "serde_json"]
|
hot_reload = ["dioxus-rsx-interpreter", "web-sys/WebSocket", "web-sys/Location", "web-sys/MessageEvent", "web-sys/console", "serde_json"]
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
dioxus-core-macro = { path = "../core-macro" }
|
dioxus-core-macro = { path = "../core-macro" }
|
||||||
|
|||||||
@@ -275,9 +275,14 @@ pub async fn run_with_props<T: 'static + Send>(root: Component<T>, root_props: T
|
|||||||
// forward stream to the websocket
|
// forward stream to the websocket
|
||||||
dom.base_scope().spawn_forever(async move {
|
dom.base_scope().spawn_forever(async move {
|
||||||
while let Some(err) = error_channel_receiver.next().await {
|
while let Some(err) = error_channel_receiver.next().await {
|
||||||
if let Error::RecompileRequiredError(err) = err {
|
match err {
|
||||||
ws.send_with_str(serde_json::to_string(&err).unwrap().as_str())
|
Error::RecompileRequiredError(err) => {
|
||||||
.unwrap();
|
ws.send_with_str(serde_json::to_string(&err).unwrap().as_str())
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
|
Error::ParseError(err) => {
|
||||||
|
web_sys::console::warn_1(&wasm_bindgen::JsValue::from_str(&err.to_string()))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in new issue
Block a user