Crate gui_panic_handler

Source
Expand description

§GUI panic handler

This crate allows you to handle panics with a GUI dialog made with egui.

The dialog shows panic payload, information about location of the panic and if you want, an option to report the panic to developer and external links.

You will most likely want to use register to register the panic handler.

§A simple example

Screenshot of a dialog with crash information
use gui_panic_handler::AppInfo;
use gui_panic_handler::Link;

gui_panic_handler::register(AppInfo {
    name: "Sample app",
    additional_text: "We are sorry, the application has crashed. To help us fix the crash, please report it using the button below.",
    links: vec![
        Link {
            label: "Browse known crash causes",
            url: "https://example.com",
        },
        Link {
            label: "Get help on our forum",
            url: "https://example.com",
        },
        Link {
            label: "Our website",
            url: "https://example.com",
        },
    ],
    report_bug_url: Some(gui_panic_handler::GitHubBugReporter::new(
        String::from("FireFragment"),
        String::from("rust_gui_panic_handler"),
    )),
});

println!("Reading env var...");
let env_var_value = std::env::var("SUPER_IMPORTANT_ENVIRONMENT_VARIABLE").unwrap();

println!("Read: {env_var_value}")

Re-exports§

pub use urlencoding;

Structs§

AppInfo
Information about the application used in the error dialog box If you don’t want to have bug report button, you can use AppInfoNoBugReport instead
GitHubBugReporter
Link
A link to be displayed in the error dialog box

Traits§

ReportBugUrlMaker
Generates a URL for bug reports - to be used as AppInfo::report_bug_url.

Functions§

details
Puts all details about the crash to a single string.
register
Register the panic handler. Run at the beggining of your program.
show_gui_egui
Displays the panic dialog using egui

Type Aliases§

AppInfoNoBugReport
Type alias for AppInfo to help solve generics inference issue in case of no bug reporting.