Oopsie woopsie!

A crate to make debugging unexpected panics easier both on developer and consumer machines. Provides a panic handler which generates a helpful panic message and saves a backtrace, system information and minidump to a file.

Features

Usage example

``` use std::panic;

fn main() { panic::sethook(Box::new(|panicinfo: &panic::PanicInfo| { let panichandlingconfig = oopsiewoopsie::PanicHandlingConfig { terminationmethod: "exit".tostring(), // The method used to terminate the program. Possible values: Exit, Abort, Loop. terminationexitcode: Some(101), // The returned error code when termination method Exit is used. Defaults to exit code 101. panicinfologfiledestination: "C:/some/path/panic.txt".tostring(), // The path where to place the panic info log file. minidumpfiledestination: "C:/some/path/panic.mdmp".tostring(), // The path where to place the minidump file. Will be ignored if feature write_minidump is disabled. };

    // Replaces the default panic handler with the custom made one.
    oopsie_woopsie::handle_error(
        panicinfo,
        panic_handling_config,
        Some(std::backtrace::Backtrace::force_capture()), // If you don't want to capture a backtrace, set this to `None`.
    );
}));

} ```

Example generated panic message (With enabled features write_panic_log and write_minidump)

``` [PANIC HANDLER INFO] Writing panic info.

A panic occured!

Panic location: file "src\main.rs" - line 20 column 5. Panic payload: a very interesting panic message right here.

[PANIC HANDLER INFO] Attempted to write panic info. Status: Ok(()). [PANIC HANDLER INFO] Reading system info. [PANIC HANDLER INFO] Read system info. [PANIC HANDLER INFO] Writing information to panic log file "C:/some/path/panic.txt". [PANIC HANDLER INFO] Attempted to write panic log file. Status: Ok(()). [PANIC HANDLER INFO] Writing minidump file to "C:/some/path/panic.mdmp" [PANIC HANDLER INFO] Attempted to write minidump file. Status: Ok(()). ```

Example generated panic message using the oofs error handling library (Using example 1)

``` [PANIC HANDLER INFO] Writing panic info.

A panic occured!

Panic location: file "src\main.rs" - line 36 column 21. Panic payload: inner_fn($0, $1) failed at src\main.rs:9:5

Parameters: $0: usize = 123 $1: &str = "hello world"

[PANIC HANDLER INFO] Attempted to write panic info. Status: Ok(()). [PANIC HANDLER INFO] Reading system info. [PANIC HANDLER INFO] Read system info. [PANIC HANDLER INFO] Writing information to panic log file "C:/some/path/panic.txt". [PANIC HANDLER INFO] Attempted to write panic log file. Status: Ok(()). [PANIC HANDLER INFO] Writing minidump file to "C:/some/path/panic.mdmp". [PANIC HANDLER INFO] Attempted to write minidump file. Status: Ok(()). ```

Reminder: This crate only works for panics. It cannot debug crashes. If you need crash debugging, you need to use an out-of-process crash handler such as Breakpad, Crashpad. There is also EmbarkStudio's Crash handling utility crates.

Also another thing: I do not have any other ideas i would like to add to this crate, so it will probably just contain bug fixes. If you have a suggestion, you can open an issue in the Github repository.