cursive_multiplex/
error.rs

1use crate::Id;
2use thiserror::Error;
3
4#[derive(Debug, Error)]
5pub enum AddViewError {
6    #[error("some error occured")]
7    GenericError {},
8}
9
10#[derive(Debug, Error)]
11pub enum RemoveViewError {
12    #[error("invalid id given, cannot be removed: {}", id)]
13    InvalidId { id: Id },
14
15    #[error("id has no parent, cannot be removed: {}", id)]
16    NoParent { id: Id },
17
18    #[error("something broke, oh no ")]
19    Generic {},
20}
21
22#[derive(Debug, Error)]
23pub enum SwitchError {
24    #[error("node {} has no parent to be switched to from {}", from, to)]
25    NoParent { from: Id, to: Id },
26
27    #[error("error while switching, figuring out...")]
28    Failed {},
29}
30
31#[derive(Debug, Error)]
32pub enum RenderError {
33    #[error("encountered arithmetic error")]
34    Arithmetic {},
35}
36
37impl std::convert::From<indextree::NodeError> for SwitchError {
38    fn from(_error: indextree::NodeError) -> Self {
39        SwitchError::Failed {}
40    }
41}