1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use std::result;

use thiserror::Error;

/// Canonical error type for this crate.
#[derive(Error, Debug)]
pub enum Error {
    /// A system error occurred.
    #[error("System error, errno: {0}")]
    System(i32),
    /// An input was invalid.
    #[error("Input input: {0}")]
    InvalidInput(String),
    /// An internal error occurred.
    #[error("Internal error: {0}")]
    Internal(String),
}

/// The result type used by this library, defaulting to [`Error`][crate::Error]
/// as the error type.
pub type Result<T> = result::Result<T, Error>;