Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
picodata
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
core
picodata
Commits
d5b8e5b0
Commit
d5b8e5b0
authored
1 year ago
by
Egor Ivkov
Committed by
Егор Ивков
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
feat: detect cas errors from generic strings
parent
442d0dfd
No related branches found
No related tags found
1 merge request
!601
refactor: improve join/update instance with cas
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/traft/error.rs
+16
-0
16 additions, 0 deletions
src/traft/error.rs
with
16 additions
and
0 deletions
src/traft/error.rs
+
16
−
0
View file @
d5b8e5b0
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment