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 33 34 35 36 37 38 39 40 41
use crate::Id; use thiserror::Error; #[derive(Debug, Error)] pub enum AddViewError { #[error("some error occured")] GenericError {}, } #[derive(Debug, Error)] pub enum RemoveViewError { #[error("invalid id given, cannot be removed: {}", id)] InvalidId { id: Id }, #[error("id has no parent, cannot be removed: {}", id)] NoParent { id: Id }, #[error("something broke, oh no ")] Generic {}, } #[derive(Debug, Error)] pub enum SwitchError { #[error("node {} has no parent to be switched to from {}", from, to)] NoParent { from: Id, to: Id }, #[error("error while switching, figuring out...")] Failed {}, } #[derive(Debug, Error)] pub enum RenderError { #[error("encountered arithmetic error")] Arithmetic {}, } impl std::convert::From<indextree::NodeError> for SwitchError { fn from(_error: indextree::NodeError) -> Self { SwitchError::Failed {} } }