1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use thiserror::Error;
#[derive(Debug, Error)]
pub enum Error {
    
    #[error("Duplicate metrics collector registration attempted")]
    AlreadyReg,
    
    #[error("Inconsistent label cardinality, expect {expect} label values, but got {got}")]
    InconsistentCardinality {
        
        expect: usize,
        
        got: usize,
    },
    
    #[error("Error: {0}")]
    Msg(String),
    
    #[error("Io error: {0}")]
    Io(#[from] std::io::Error),
    
    #[cfg(feature = "protobuf")]
    #[error("Protobuf error: {0}")]
    Protobuf(#[from] protobuf::error::ProtobufError),
}
pub type Result<T> = std::result::Result<T, Error>;