Skip to main content

hyperlane/error/
enum.rs

1use crate::*;
2
3/// Represents errors that can occur at the server level.
4#[derive(Clone, CustomDebug, Deserialize, DisplayDebug, Eq, PartialEq, Serialize)]
5pub enum ServerError {
6    /// An error occurred while trying to bind to a TCP socket.
7    TcpBind(String),
8    /// An unknown or unexpected error occurred.
9    Unknown(String),
10    /// An error occurred while reading an HTTP request.
11    HttpRead(String),
12    /// The received HTTP request was invalid or malformed.
13    InvalidHttpRequest(Request),
14    /// Other error.
15    Other(String),
16}
17
18/// Represents errors related to route definitions and matching.
19#[derive(Clone, CustomDebug, Deserialize, DisplayDebug, Eq, PartialEq, Serialize)]
20pub enum RouteError {
21    /// The route pattern cannot be empty.
22    EmptyPattern,
23    /// A route with the same pattern has already been defined.
24    DuplicatePattern(String),
25    /// The provided route pattern is not a valid regular expression.
26    InvalidRegexPattern(String),
27}