1use std::fmt::Debug;
2
3use thiserror::Error;
4
5use crate::util::ID;
6
7#[derive(Error, Debug)]
8#[non_exhaustive]
9pub enum Error {
10 #[error("rusqlite error: {0:?}")]
11 RuSQLite(#[from] rusqlite::Error),
12
13 #[error("No node {0}")]
14 NoNode(ID),
15 #[error("No node {0} of type {1}")]
16 NoNodeOfType(ID, &'static str),
17 #[error("No aircraft {0}")]
18 NoAircraft(String),
19 #[error("Node {0} not Located")]
20 NodeNotLocated(ID),
21
22 #[error("HTTP GET error: {0:?}")]
23 HTTPGetError(Box<dyn Debug + Send + Sync + 'static>),
24
25 #[error("unknown error: {0:?}")]
26 Unknown(#[from] anyhow::Error),
27}
28
29pub type Result<T, E = Error> = std::result::Result<T, E>;