Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
arti
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
smitop
arti
Commits
5c87cd1e
Commit
5c87cd1e
authored
3 years ago
by
Nick Mathewson
Browse files
Options
Downloads
Patches
Plain Diff
Update retry-error README
parent
b9948679
No related branches found
Branches containing commit
Tags
tor-0.0.9rc1
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
retry-error/README.md
+8
-20
8 additions, 20 deletions
retry-error/README.md
with
8 additions
and
20 deletions
retry-error/README.md
+
8
−
20
View file @
5c87cd1e
#
tor-
retry
# retry
-error
Helpers to implement retry-related functionality
.
An error attempt to represent multiple failures
.
Right now, this crate only has an error
type t
hat we
use when
we
retry something a few times, and
they all fail
. Instead of
This crate implements [
`RetryError`
], a
type t
o
use when
you
retry something a few times, and
all those attempts
. Instead of
returning only a single error, it records _all of the errors
received, in case they are different.
received
_
, in case they are different.
This crate is part of
This crate is
developed as
part of
[
Arti
](
https://gitlab.torproject.org/tpo/core/arti/
)
, a project to
implement
[
Tor
](
https://www.torproject.org/
)
in Rust.
It's used by higher-level crates that retry
operations.
### Design notes
XXXX We'll want to refactor this one. It might be better in a
crate called retry-error or something, since it isn't
tor-specific.
The [
`RetryError`
] type might be more generally useful in the
future, if it gets a stable interface, and if we can make it stop
depending on [
`anyhow`
].
Maybe this error type should be parameterized on an input error type.
## Example
```
rust
use
tor_
retry
::
RetryError
;
use
retry
_error
::
RetryError
;
const
N_ATTEMPTS
:
usize
=
10
;
let
mut
err
=
RetryError
::
while_doing
(
"perform an example operation"
);
let
mut
err
=
RetryError
::
in_attempt_to
(
"perform an example operation"
);
for
_
in
0
..
N_ATTEMPTS
{
match
some_operation
()
{
Ok
(
val
)
=>
return
Ok
(
val
),
...
...
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