Skip to content
Snippets Groups Projects
Commit d5b8e5b0 authored by Egor Ivkov's avatar Egor Ivkov Committed by Егор Ивков
Browse files

feat: detect cas errors from generic strings

parent 442d0dfd
No related branches found
No related tags found
1 merge request!601refactor: improve join/update instance with cas
......@@ -83,6 +83,22 @@ impl Error {
{
Self::Other(error.into())
}
/// Temporary solution until proc_cas returns structured errors
pub fn is_cas_err(&self) -> bool {
self.to_string().contains("compare-and-swap request failed")
}
/// Temporary solution until proc_cas returns structured errors
pub fn is_term_mismatch_err(&self) -> bool {
self.to_string()
.contains("operation request from different term")
}
/// Temporary solution until proc_cas returns structured errors
pub fn is_not_leader_err(&self) -> bool {
self.to_string().contains("not a leader")
}
}
impl<E> From<timeout::Error<E>> for Error
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment