Skip to main content

leyline/core/error/
profile.rs

1use std::fmt;
2
3use super::Error;
4
5#[derive(Debug)]
6pub(crate) struct ProfileChanged;
7
8impl fmt::Display for ProfileChanged {
9    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
10        f.write_str("the session profile differs from the pinned profile")
11    }
12}
13
14impl std::error::Error for ProfileChanged {}
15
16impl Error {
17    pub fn is_profile_changed(&self) -> bool {
18        self.source_as::<ProfileChanged>().is_some()
19    }
20}