bgpfu/
error.rs

1use rpsl::{attr::AttributeType, error::ParseError, expr::eval::EvaluationError, obj::RpslObject};
2
3/// Error condition variants.
4#[derive(Debug, thiserror::Error)]
5pub enum Error {
6    /// IRR query protocol errors.
7    #[error(transparent)]
8    Irr(#[from] irrc::Error),
9    /// RPSL expression evaluation errors.
10    #[error(transparent)]
11    Evaluation(#[from] EvaluationError),
12    /// RPSL parsing errors.
13    #[error(transparent)]
14    Parse(#[from] ParseError),
15    /// The connection to the IRRd server couldn't be acquired.
16    #[error("failed to acquire the connection to the IRRd server")]
17    AcquireConnection,
18    /// The required attribute was not found in the RPSL object.
19    #[error("no {0} attribute found in RPSL object {1}")]
20    FindAttribute(AttributeType, RpslObject),
21    /// An unexpected RPSL object type was received.
22    #[error("unexpected RPSL object {0}")]
23    RpslObjectClass(RpslObject),
24}