ncurseswwin/ncurseswwinerror/
ncurseswwinerror.rs1use std::{num, convert, ffi};
24use thiserror::Error;
25use ncursesw::{
26 NCurseswError, panels::NCurseswPanelsError, mouse::NCurseswMouseError,
27 menu::NCurseswMenuError, form::NCurseswFormError
28};
29use crate::ripoff::MAX_RIPOFF_LINES;
30
31#[derive(Error, Debug, PartialEq, Eq)]
33pub enum NCurseswWinError {
34 #[error("ncurses has already been initialised")]
35 InitscrAlreadyCalled,
36 #[error("ncurses has not been initialised")]
37 InitscrNotCalled,
38 #[error("ncurseswwin::start_color() already called")]
39 StartColorAlreadyCalled,
40 #[error("ncurseswwin::start_color() not called")]
41 StartColorNotCalled,
42 #[error("attempt to initialise ripoff {number}, maximum ripoff's allowed {}", MAX_RIPOFF_LINES)]
43 MaximumRipoffLines { number: usize },
44 #[error("an internal error has occured")]
45 InternalError,
46 #[error("{message}")]
47 Panic { message: String },
48 #[error("{func}() out of memory!!!")]
49 OutOfMemory { func: String },
50 #[error("unable to obtain a valid mouse id!!!")]
51 MouseId,
52 #[error("{func}() too many arguments {args}")]
53 FieldTypeArguments { func: String, args: u8 },
54 #[error("softlabel already defined.")]
55 SoftLabelAlreadyDefined,
56
57 #[error("{source}")]
58 NCurseswError { #[from] source: NCurseswError },
59 #[error("{source}")]
60 PanelsError { #[from] source: NCurseswPanelsError },
61 #[error("{source}")]
62 MouseError { #[from] source: NCurseswMouseError },
63 #[error("{source}")]
64 MenuError { #[from] source: NCurseswMenuError },
65 #[error("{source}")]
66 FormError { #[from] source: NCurseswFormError },
67
68 #[error("{source}")]
69 TryFromIntError { #[from] source: num::TryFromIntError },
70 #[error("{source}")]
71 NulError { #[from] source: ffi::NulError },
72 #[error("{source}")]
73 Infallible { #[from] source: convert::Infallible }
74}