virtio-devices: net: Derive thiserror::Error

Signed-off-by: Bo Chen <chen.bo@intel.com>
This commit is contained in:
Bo Chen 2022-08-10 15:46:18 -07:00 committed by Rob Bradford
parent 54c484397e
commit a7f3620564

View File

@ -32,6 +32,7 @@ use std::sync::{Arc, Barrier};
use std::thread;
use std::vec::Vec;
use std::{collections::HashMap, convert::TryInto};
use thiserror::Error;
use versionize::{VersionMap, Versionize, VersionizeResult};
use versionize_derive::Versionize;
use virtio_bindings::bindings::virtio_net::*;
@ -138,15 +139,13 @@ pub const RX_RATE_LIMITER_EVENT: u16 = EPOLL_HELPER_EVENT_LAST + 5;
// New 'wake up' event from the tx rate limiter
pub const TX_RATE_LIMITER_EVENT: u16 = EPOLL_HELPER_EVENT_LAST + 6;
#[derive(Debug)]
#[derive(Error, Debug)]
pub enum Error {
/// Failed to open taps.
#[error("Failed to open taps: {0}")]
OpenTap(OpenTapError),
// Using existing tap
#[error("Using existing tap: {0}")]
TapError(TapError),
// Error calling dup() on tap fd
#[error("Error calling dup() on tap fd: {0}")]
DuplicateTapFd(std::io::Error),
}