fatal 0.1.0

End-user friendly panics.
Documentation
fatal-0.1.0 has been yanked.

Utilities for reporting fatal errors and exiting with an error code.

The behavior in this crate is different than the one in panic!-based exits, in that the ones here are suited for display to end-users, i.e. no "thread main panicked at", no backtrace mentions, etc.

Usage

For unwrapping Results:

For aborting:

(Pseudo-)Example:

const DB_CONSTR_VAR: &str = "DB_CONNECTION_STRING";

fn main() {
let constr: String = fatal::unwrap_message!(std::env::var(DB_CONSTR_VAR), "failed to read the `{}` environment variable", DB_CONSTR_VAR);
// when doesn't exist, will print: "Error: failed to read the `DB_CONNECTION_STRING` environment variable (environment variable not found)"
println!("Connecting to database..");
let db: Database = fatal::unwrap(Database::connect(&constr));
println!("Total users: {}", db.query_total_users());
}