1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum PcaptureError {
5 #[error("unhandled channel type")]
7 UnhandledChannelType,
8 #[error("unable to create channel: {e}")]
9 UnableCreateChannel { e: String },
10 #[error("unable to found interface: {i}")]
11 UnableFoundInterface { i: String },
12 #[error("capture the packet error: {e}")]
13 CapturePacketError { e: String },
14 #[error("std io error")]
15 IOError(#[from] std::io::Error),
16 #[error("get system time error")]
17 SystemTimeError(#[from] std::time::SystemTimeError),
18 #[error("The write file descriptor does not exist")]
19 FileDescriptorDoesNotExist,
20 #[error("Try to unlock {name} error: {e}")]
21 UnlockGlobalVariableError { name: String, e: String },
22 #[error("This function can only be used in pcapng format")]
23 PcapNgOnlyError,
24 #[error("can not get thread status, thread id {thread_id}")]
25 UnableGetThreadStatus { thread_id: u32 },
26
27 #[error("unknown linktype [{linktype}]")]
29 UnknownLinkType { linktype: u32 },
30
31 #[error("get cpu model info error")]
33 GetSystemInfoError,
34 #[error("subnetwork lib error")]
35 SubnetworkError(#[from] subnetwork::SubnetworkError),
36 #[error("unknown block type [{blocktype}]")]
37 UnknownBlockType { blocktype: u32 },
38 #[error("unsupported block type [{blockname}]")]
39 UnsupportedBlockType { blockname: String },
40
41 #[error("{msg}")]
43 ShouldHaveValueError { msg: String },
44 #[error("parse [{parameter}] to [{target}] error: {e}")]
45 ValueError {
46 parameter: String,
47 target: String,
48 e: String,
49 },
50 #[error("unknown operator [{op}]")]
51 UnknownOperator { op: String },
52}