Enum cni_plugin::error::CniError [−][src]
All errors emitted by this library, plus a few others.
Variants
Io(Error)Catch-all wrapper for I/O errors.
Json(Error)Catch-all wrapper for JSON serialization and deserialization.
Incompatible(Version)When the CNI version requested by the runtime is not supported.
The Version in the error is the CNI version provided, not ours.
Also see VersionReply.
When nothing is provided on STDIN.
When a delegated plugin doesn’t output anything on STDOUT.
When a required environment variable is missing.
When an environment variable couldn’t be parsed or is invalid.
When the current working directory cannot be obtained (for delegation).
When a delegated plugin cannot be found on CNI_PATH.
Wrapper for errors in relation to a delegated plugin.
Generic(String)A generic error as a string.
This error variant is not used in the library, but is provided for plugin implementations to make use of without needing to make their own error type.
Example
CniError::Generic("a total catastrophe".into());
A debug error as anything that implements Debug.
This error variant is not used in the library, but is provided for plugin implementations to make use of without needing to make their own error type.
Example
CniError::Debug(Box::new(("hello", "world", vec![1, 2, 3])));
MissingField(&'static str)When a field in configuration is missing.
This error variant is not used in the library, but is provided for plugin implementations to make use of without needing to make their own error type.
Example
CniError::MissingField("ipam.type");
When a field in configuration is invalid.
This error variant is not used in the library, but is provided for plugin implementations to make use of without needing to make their own error type.
Example
CniError::InvalidField { field: "ipam.pool", expected: "string", value: Value::Null, };
Fields of InvalidField
Implementations
impl CniError[src]
pub fn into_reply(self, cni_version: Version) -> ErrorReply<'static>[src]
Convert a CniError into an ErrorReply.
ErrorReplys can be used with reply, but
require cni_version to be set to the input configuration’s. This
method makes it easier to create errors (including with the ?
operator, from foreign error types) and only populate the version field
when ready to send the reply.
It’s recommended to add an implementation of this if you make your own error type.
Trait Implementations
impl Debug for CniError[src]
impl Display for CniError[src]
impl Error for CniError[src]
fn source(&self) -> Option<&(dyn Error + 'static)>[src]
pub fn backtrace(&self) -> Option<&Backtrace>[src]
pub fn description(&self) -> &str1.0.0[src]
pub fn cause(&self) -> Option<&dyn Error>1.0.0[src]
impl From<Error> for CniError[src]
impl From<Error> for CniError[src]
Auto Trait Implementations
impl !RefUnwindSafe for CniError
impl !Send for CniError
impl !Sync for CniError
impl Unpin for CniError
impl !UnwindSafe for CniError
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized, [src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,