1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::error::Error;
use std::fmt::{Display, Formatter};

#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
pub enum PolylineError {
    PolylineAlreadyClosed,
    InvalidPolyline,
}
impl Display for PolylineError {
    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
        match self {
            PolylineError::PolylineAlreadyClosed => write!(f, "Polyline has already been closed"),
            PolylineError::InvalidPolyline => write!(f, "Polyline has invalid segments"),
        }
    }
}

impl Error for PolylineError {}