irox_networking/
error.rs

1// SPDX-License-Identifier: MIT
2// Copyright 2023 IROX Contributors
3//
4
5use crate::address::AddressError;
6use irox_tools::{impl_err_fn, impl_error, impl_from_error};
7
8#[derive(Debug, Copy, Clone, Eq, PartialEq)]
9pub enum ErrorType {
10    IOError,
11    AddressError,
12    MissingPort,
13    UnknownScheme,
14}
15
16impl_error!(Error, ErrorType);
17impl_from_error!(Error, std::io::Error, ErrorType::IOError);
18impl_from_error!(Error, AddressError, ErrorType::AddressError);
19
20impl_err_fn!(
21    Error,
22    ErrorType::MissingPort,
23    missing_port,
24    missing_port_err
25);
26impl_err_fn!(
27    Error,
28    ErrorType::UnknownScheme,
29    unknown_scheme,
30    unknown_scheme_err
31);