~deciduously/fcalc

ref: ab5f3ffdbc8c819466fedac28c8317b6af8bd799 fcalc/src/error.rs -rw-r--r-- 472 bytes
ab5f3ffdBen Lovy ItemQuantity a month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//! Top-level error struct

use std::io;
use thiserror::Error;

#[derive(Debug, Error)]
pub enum FcalcError {
    #[error("Input data error")]
    IOError(#[from] io::Error),
    #[error("Bad product type")]
    ProductTypeError,
    #[error("Bad building type")]
    InvalidBuildingType,
    #[error("Invalid item quanitty string")]
    ItemQuantityError,
}

/// Export convenient Result type carrying this error.
pub type Result<T> = std::result::Result<T, FcalcError>;