Skip to main content

SubXErrorExt

Trait SubXErrorExt 

Source
pub trait SubXErrorExt {
    // Required methods
    fn exit_code(&self) -> i32;
    fn user_friendly_message(&self) -> String;
}
Expand description

Presentation-layer extensions to SubXError owned by the binary.

Required Methods§

Source

fn exit_code(&self) -> i32

Return the corresponding exit code for this error variant.

§Examples
assert_eq!(SubXError::config("x").exit_code(), 2);
Source

fn user_friendly_message(&self) -> String

Return a user-friendly error message with suggested remedies.

§Examples
let msg = SubXError::config("missing key").user_friendly_message();
assert!(msg.contains("Configuration error:"));

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§