[][src]Crate user_error

User Facing Error

A library for conveniently displaying well-formatted, and good looking errors to users of CLI applications. Useful for bubbling up unrecoverable errors to inform the user what they can do to fix them. Error messages you'd be proud to show your mom.



The eponymous struct. You can create a new one from using user_error::UserFacingError::new() however I recommend you use your own error types and have them implement UFE instead of using UserFacingError directly. This is more of an example type, or a way to construct a pretty messages without implementing your own error type.



You can implement UFE on your error types pretty print them. The default implementation will print Error: <your error .to_string()> followed by a list of reasons that are any errors returned by .source(). You should only override the summary, reasons and help text functions. The pretty print versions of these are used by print(), print_and_exit() and contain the formatting. If you wish to change the formatting you should update it with the formatting functions.