mirror of
https://github.com/open-goal/launcher.git
synced 2024-10-19 14:47:36 -04:00
backend: display a popup error when an unrecoverable panic occurs (#553)
Fixes #279 At first I wanted to test if uninstalling WebView2 properly and running the installer does what it is supposed to do and install it for you. However, since mid-2023 -- Microsoft has made WebView2 a **required system dependency of the operating system itself**, and therefore you **cannot easily uninstall it**. This is something I don't want to mess with on my own machine. So instead I added a clear popup (where if you are on windows, it'll tell you to get WebView2) when a panic occurs. Instead of hoping people find the crash report file on their desktop. ![image](https://github.com/user-attachments/assets/97dda538-96be-433a-965c-e3ddf6a59f3e)
This commit is contained in:
parent
10515ef6c3
commit
7c9de0ab39
95
src-tauri/Cargo.lock
generated
95
src-tauri/Cargo.lock
generated
|
@ -131,6 +131,12 @@ version = "0.7.6"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
|
||||
|
||||
[[package]]
|
||||
name = "ascii"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d92bec98840b8f03a5ff5413de5293bfcd8bf96467cf5452609f939ec6f5de16"
|
||||
|
||||
[[package]]
|
||||
name = "ash"
|
||||
version = "0.38.0+1.3.281"
|
||||
|
@ -660,6 +666,22 @@ dependencies = [
|
|||
"objc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cocoa"
|
||||
version = "0.25.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f6140449f97a6e97f9511815c5632d84c8aacf8ac271ad77c559218161a1373c"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"block",
|
||||
"cocoa-foundation",
|
||||
"core-foundation",
|
||||
"core-graphics 0.23.2",
|
||||
"foreign-types 0.5.0",
|
||||
"libc",
|
||||
"objc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cocoa-foundation"
|
||||
version = "0.1.2"
|
||||
|
@ -2374,6 +2396,15 @@ dependencies = [
|
|||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57"
|
||||
dependencies = [
|
||||
"either",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "0.4.8"
|
||||
|
@ -2768,6 +2799,29 @@ dependencies = [
|
|||
"unicode-xid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "native-dialog"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "84e7038885d2aeab236bd60da9e159a5967b47cde3292da3b15ff1bec27c039f"
|
||||
dependencies = [
|
||||
"ascii",
|
||||
"block",
|
||||
"cocoa 0.25.0",
|
||||
"core-foundation",
|
||||
"dirs-next",
|
||||
"objc",
|
||||
"objc-foundation",
|
||||
"objc_id",
|
||||
"once_cell",
|
||||
"raw-window-handle 0.5.2",
|
||||
"thiserror",
|
||||
"versions",
|
||||
"wfd",
|
||||
"which",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "native-tls"
|
||||
version = "0.2.12"
|
||||
|
@ -3126,6 +3180,7 @@ dependencies = [
|
|||
"futures-util",
|
||||
"glob",
|
||||
"log",
|
||||
"native-dialog",
|
||||
"reqwest 0.12.7",
|
||||
"rev_buf_reader",
|
||||
"rustc-serialize",
|
||||
|
@ -4650,7 +4705,7 @@ dependencies = [
|
|||
"bitflags 1.3.2",
|
||||
"cairo-rs",
|
||||
"cc",
|
||||
"cocoa",
|
||||
"cocoa 0.24.1",
|
||||
"core-foundation",
|
||||
"core-graphics 0.22.3",
|
||||
"crossbeam-channel",
|
||||
|
@ -4724,7 +4779,7 @@ checksum = "0e33e3ba00a3b05eb6c57ef135781717d33728b48acf914bb05629e74d897d29"
|
|||
dependencies = [
|
||||
"anyhow",
|
||||
"bytes",
|
||||
"cocoa",
|
||||
"cocoa 0.24.1",
|
||||
"dirs-next",
|
||||
"dunce",
|
||||
"embed_plist",
|
||||
|
@ -4862,7 +4917,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "18c447dcd9b0f09c7dc4b752cc33e72788805bfd761fbda5692d30c48289efec"
|
||||
dependencies = [
|
||||
"arboard",
|
||||
"cocoa",
|
||||
"cocoa 0.24.1",
|
||||
"gtk",
|
||||
"percent-encoding",
|
||||
"rand 0.8.5",
|
||||
|
@ -5433,6 +5488,16 @@ version = "0.9.5"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
|
||||
|
||||
[[package]]
|
||||
name = "versions"
|
||||
version = "5.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c73a36bc44e3039f51fbee93e39f41225f6b17b380eb70cc2aab942df06b34dd"
|
||||
dependencies = [
|
||||
"itertools",
|
||||
"nom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "vswhom"
|
||||
version = "0.1.0"
|
||||
|
@ -5738,6 +5803,16 @@ version = "0.1.8"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082"
|
||||
|
||||
[[package]]
|
||||
name = "wfd"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e713040b67aae5bf1a0ae3e1ebba8cc29ab2b90da9aa1bff6e09031a8a41d7a8"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wgpu"
|
||||
version = "22.1.0"
|
||||
|
@ -5844,6 +5919,18 @@ dependencies = [
|
|||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "which"
|
||||
version = "4.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7"
|
||||
dependencies = [
|
||||
"either",
|
||||
"home",
|
||||
"once_cell",
|
||||
"rustix",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "widestring"
|
||||
version = "1.1.0"
|
||||
|
@ -6435,7 +6522,7 @@ checksum = "c55c80b12287eb1ff7c365fc2f7a5037cb6181bd44c9fce81c8d1cf7605ffad6"
|
|||
dependencies = [
|
||||
"base64 0.13.1",
|
||||
"block",
|
||||
"cocoa",
|
||||
"cocoa 0.24.1",
|
||||
"core-graphics 0.22.3",
|
||||
"crossbeam-channel",
|
||||
"dunce",
|
||||
|
|
|
@ -42,6 +42,7 @@ wgpu = "22.1.0"
|
|||
zip = { version = "2.2.0", features = ["deflate-zlib-ng"] }
|
||||
zip-extract = "0.2.1"
|
||||
tempfile = "3.12.0"
|
||||
native-dialog = "0.7.0"
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
winreg = "0.52.0"
|
||||
|
|
|
@ -10,6 +10,7 @@ use tokio::sync::OnceCell;
|
|||
use util::file::create_dir;
|
||||
|
||||
use backtrace::Backtrace;
|
||||
use native_dialog::{MessageDialog, MessageType};
|
||||
use std::io::Write;
|
||||
|
||||
mod cache;
|
||||
|
@ -40,6 +41,19 @@ fn log_crash(panic_info: Option<&std::panic::PanicInfo>, error: Option<tauri::Er
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
let mut dialog_text = format!("Unrecoverable crash occurred!");
|
||||
if cfg!(windows) {
|
||||
dialog_text = format!("{dialog_text} Ensure you have not uninstalled WebView2: https://developer.microsoft.com/en-us/microsoft-edge/webview2/?form=MA13LH#download");
|
||||
}
|
||||
dialog_text = format!("{dialog_text}\n\nDetails:\n{log_contents}");
|
||||
|
||||
MessageDialog::new()
|
||||
.set_type(MessageType::Error)
|
||||
.set_title("OpenGOAL Launcher Crash Info")
|
||||
.set_text(&dialog_text)
|
||||
.show_alert()
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
fn panic_hook(info: &std::panic::PanicInfo) {
|
||||
|
|
Loading…
Reference in a new issue