mirror of
https://github.com/Stremio/stremio-shell-ng.git
synced 2026-04-21 11:51:56 +00:00
Better IPC error handling
This commit is contained in:
parent
3b31ca1ab9
commit
6846dad9e6
1 changed files with 9 additions and 5 deletions
|
|
@ -148,14 +148,15 @@ impl MainWindow {
|
||||||
}),
|
}),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
let resp_json = serde_json::to_string(&resp).unwrap();
|
let resp_json =
|
||||||
|
serde_json::to_string(&resp).expect("Cannot build response");
|
||||||
web_tx_web.send(resp_json).ok();
|
web_tx_web.send(resp_json).ok();
|
||||||
} else if let Some(args) = msg.args {
|
} else if let Some(args) = msg.args {
|
||||||
// TODO: this can panic
|
|
||||||
if let Some(method) = args.first() {
|
if let Some(method) = args.first() {
|
||||||
let method = method.as_str().unwrap();
|
let method = method.as_str().unwrap_or("invalid-method");
|
||||||
if method.starts_with("mpv-") {
|
if method.starts_with("mpv-") {
|
||||||
let resp_json = serde_json::to_string(&args).unwrap();
|
let resp_json =
|
||||||
|
serde_json::to_string(&args).expect("Cannot build response");
|
||||||
player_tx.send(resp_json).ok();
|
player_tx.send(resp_json).ok();
|
||||||
} else {
|
} else {
|
||||||
match method {
|
match method {
|
||||||
|
|
@ -172,7 +173,10 @@ impl MainWindow {
|
||||||
hide_splash_sender.notice();
|
hide_splash_sender.notice();
|
||||||
if args.len() > 1 {
|
if args.len() > 1 {
|
||||||
// TODO: Make this modal dialog
|
// TODO: Make this modal dialog
|
||||||
eprintln!("Web App Error: {}", args[1].as_str().unwrap_or("Unknown error"));
|
eprintln!(
|
||||||
|
"Web App Error: {}",
|
||||||
|
args[1].as_str().unwrap_or("Unknown error")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => eprintln!("Unsupported command {:?}", args),
|
_ => eprintln!("Unsupported command {:?}", args),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue