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§
Source§impl 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§
Source§impl Debug for InvalidArgumentError
impl Debug for InvalidArgumentError
Source§impl Display for InvalidArgumentError
impl Display for InvalidArgumentError
Source§impl Error for InvalidArgumentError
impl Error for InvalidArgumentError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for InvalidArgumentError
impl RefUnwindSafe for InvalidArgumentError
impl Send for InvalidArgumentError
impl Sync for InvalidArgumentError
impl Unpin for InvalidArgumentError
impl UnwindSafe for InvalidArgumentError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more