Struct grid_sdk::error::InvalidArgumentError
source · [−]pub struct InvalidArgumentError { /* private fields */ }
Expand description
An error returned when an argument passed to a function does not conform to the expected format.
This always indicates a programming error on behalf of the caller, since the caller should have verified the argument prior to passing it into the function.
Implementations
sourceimpl InvalidArgumentError
impl InvalidArgumentError
sourcepub fn new(argument: String, message: String) -> Self
pub fn new(argument: String, message: String) -> Self
Constructs a new InvalidArgumentError
with a specified argument and message string.
The argument passed in should be the name of the argument in the function’s signature. The message should be the reason it is invalid, and should not contain the name of the argument (since Display will combine both argument and message).
The implementation of std::fmt::Display
for this error will be a combination of the
argument and the message string provided.
Examples
use grid_sdk::error::InvalidArgumentError;
let invalid_arg_error = InvalidArgumentError::new("arg1".to_string(), "argument too long".to_string());
assert_eq!(format!("{}", invalid_arg_error), "argument too long (arg1)");
Trait Implementations
sourceimpl Debug for InvalidArgumentError
impl Debug for InvalidArgumentError
sourceimpl Display for InvalidArgumentError
impl Display for InvalidArgumentError
sourceimpl Error for InvalidArgumentError
impl Error for InvalidArgumentError
1.30.0 · sourcefn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
sourcefn backtrace(&self) -> Option<&Backtrace>
fn backtrace(&self) -> Option<&Backtrace>
backtrace
)Returns a stack backtrace, if available, of where this error occurred. Read more
1.0.0 · sourcefn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Auto Trait Implementations
impl RefUnwindSafe for InvalidArgumentError
impl Send for InvalidArgumentError
impl Sync for InvalidArgumentError
impl Unpin for InvalidArgumentError
impl UnwindSafe for InvalidArgumentError
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more