netstat/types/
error.rs
1use std;
2
3#[derive(Clone, Debug)]
5pub enum Error {
6 InternalError(&'static str),
8 ForeignError {
10 api_name: &'static str,
11 err_code: i32,
12 },
13}
14
15impl std::fmt::Display for Error {
16 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
17 match self {
18 Error::InternalError(msg) => write!(f, "InternalError: {}", msg),
19 Error::ForeignError { api_name, err_code } => write!(
20 f,
21 "ForeignError with code {} occured in `{}`.",
22 err_code, api_name
23 ),
24 }
25 }
26}
27
28impl std::error::Error for Error {}