ferroui_dynamic_data/list/
sort_exception.rs1use ferroui_system::ObservableError;
4use std::error::Error;
5use std::fmt;
6use std::rc::Rc;
7
8#[derive(Clone, Debug)]
13pub struct SortException {
14 message: String,
15 inner: Option<ObservableError>,
16}
17
18impl SortException {
19 pub fn new(message: impl Into<String>) -> Self {
21 Self { message: message.into(), inner: None }
22 }
23
24 pub fn with_inner(message: impl Into<String>, inner: ObservableError) -> Self {
26 Self { message: message.into(), inner: Some(inner) }
27 }
28
29 pub fn message(&self) -> &str {
31 &self.message
32 }
33
34 pub fn into_error(self) -> ObservableError {
36 Rc::new(self)
37 }
38}
39
40impl Default for SortException {
41 fn default() -> Self {
43 Self::new("Exception of type 'DynamicData.SortException' was thrown.")
44 }
45}
46
47impl fmt::Display for SortException {
48 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
49 f.write_str(&self.message)
50 }
51}
52
53impl Error for SortException {
54 fn source(&self) -> Option<&(dyn Error + 'static)> {
55 self.inner.as_deref()
56 }
57}