Nick Mathewson
49c87fa8f9
Implement HasKind for tor_dirclient::Error
2022-02-16 14:53:58 -05:00
Nick Mathewson
7f9bbcb437
dirclient: remove an unused error type.
2022-02-16 14:42:07 -05:00
Nick Mathewson
543916e812
Clarify and rename PendingCanceled
...
From its old name, this error had implied that we were giving no
useful information when we were waiting on a pending cirucit request
that failed. In fact, this error would only happen if we dropped the
`mpsc::Sender` for a circuit attempt without reporting success or
failure.
2022-02-16 14:35:06 -05:00
Nick Mathewson
1d773e748f
Provide a better ErrorKind from RetryError.
...
(Instead of reporting the _last_ error, report the _worst_ error.)
2022-02-16 14:35:06 -05:00
Nick Mathewson
c1899f787b
circmgr: Add a Kind for speculative guard failure.
...
These errors should almost never be seen by the user; we should instead
retry the circuit. But they _can_ be seen by the use if selecting a
guard takes too long, or too many attempts. (Therefore, they aren't true
"internal" errors.)
I suspect that we might not want to keep this TransientFailure kind, but
I'm not sure what else to do here for now.
2022-02-16 14:35:06 -05:00
Nick Mathewson
96d856e264
Add kinds for *most* circmgr errors.
...
There are a couple of tricky ones I'll do separately.
2022-02-16 14:35:06 -05:00
Nick Mathewson
900007585a
circmgr: Port InternalError to use Bug.
2022-02-16 14:35:06 -05:00
Nick Mathewson
f572baa7ad
Merge branch 'chanmgr-error' into 'main'
...
Implement HasKind for tor-chanmgr::Error
See merge request tpo/core/arti!324
2022-02-16 19:34:42 +00:00
Ian Jackson
716a060191
Merge branch 'netdir-error' into 'main'
...
Simplify tor-netdir::Error by a *lot*
See merge request tpo/core/arti!319
2022-02-16 17:52:52 +00:00
Nick Mathewson
caa70fde35
tor-chanmgr: use Bug types.
2022-02-16 11:55:47 -05:00
Nick Mathewson
10bca35bba
Implement HasKind for tor-chanmgr::Error
...
(There will be a folowup to work on internal errors here.)
2022-02-16 11:55:47 -05:00
Nick Mathewson
2147d0849f
Merge branch 'cell-proto-error' into 'main'
...
tor-cell and tor-proto: provide HasKind.
See merge request tpo/core/arti!304
2022-02-16 16:55:14 +00:00
Nick Mathewson
62a62b6dfd
tor_proto::Error: Fix an incomplete sentence.
2022-02-16 11:09:59 -05:00
eta
967f0a45f3
Merge branch 'ticket_344' into 'main'
...
Refactor tor-netdoc a bit more, to use Bug right.
See merge request tpo/core/arti!316
2022-02-16 15:21:11 +00:00
Nick Mathewson
c06bee8a11
Merge branch 'issue-320' into 'main'
...
Move persistent state flush from client to circmgr
See merge request tpo/core/arti!321
2022-02-16 13:56:34 +00:00
Yuan Lyu
98b1a5a279
Move persistent state flush from client to circmgr
2022-02-15 20:04:45 -05:00
Nick Mathewson
058e4d7705
tor-netdir: Split testnet errors into a new type
...
There's no reason to have the test-network-construction code share an
error enum with the main netdir code.
2022-02-15 14:43:36 -05:00
Nick Mathewson
ceb8e8c1e2
tor-netdir: remove unused error variants
...
This turns out to have been most of them, which
simplifies matters a lot.
2022-02-15 14:36:15 -05:00
Nick Mathewson
7c7bf2bd03
Fix a rustdoc error.
2022-02-15 13:46:58 -05:00
Nick Mathewson
6bd21d4372
Refactor tor-netdoc a bit more, to use Bug right.
2022-02-15 10:22:38 -05:00
Nick Mathewson
13f39ed896
Minimal compilation fix: InternalError=>Bug
...
This is a followup for !314 and !310 to fix compilation on main.
2022-02-15 10:13:08 -05:00
Nick Mathewson
7b6a7a57d3
Merge branch 'doc-errors' into 'main'
...
Refactor errors in tor-netdoc
See merge request tpo/core/arti!314
2022-02-15 15:09:48 +00:00
Nick Mathewson
6b611d6dea
Update tor-proto errors to latest API.
2022-02-15 09:57:03 -05:00
Nick Mathewson
8b9b42514a
Update tor-cell errors to latest API
2022-02-15 09:56:53 -05:00
Nick Mathewson
4af279b173
Make tor-proto::Error implement HasKind.
...
This took some refactoring, and gave an opportunity to notice
a few error variants that weren't being used, or didn't mean
what they said on the tin.
2022-02-15 09:41:47 -05:00
Nick Mathewson
f23f375e42
tor-proto: use InternalError for internal errors.
2022-02-15 09:41:11 -05:00
Nick Mathewson
da0e9e456c
tor-cell: provide HasKind.
...
Additionally, refactor the IoError out of tor_cell::Error:
nothing in TorCell created this; it was only used by tor_proto.
This required refactoring in tor_proto to use a new error type. Here I
decided to use a new CodecError for now, though we may refactor that
away soon too.
2022-02-15 09:41:10 -05:00
eta
cb7f068c3b
Typo fix from@eta
2022-02-15 14:34:59 +00:00
Ian Jackson
e6e4ea25c0
Merge branch 'error-kind-badargument' into 'main'
...
New name and semantics for Bug (was BadArgument)
See merge request tpo/core/arti!310
2022-02-15 14:21:28 +00:00
Ian Jackson
8688069add
tor_error::Bug: change Display impl to use kind
...
As per
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/310#note_2777626
The message from the kind is precisely right.
2022-02-15 13:58:54 +00:00
Ian Jackson
ad6cb60d8a
BadApiUsage: change Display impl capitalisation
...
Now it maches the others
2022-02-15 13:58:52 +00:00
Ian Jackson
5d636738eb
Rename BadApiUsage from BadAPIUsage
...
As per
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/310#note_2777519
mutatis mutandi.
And, fix a leftover instance with an old idea of what this was called.
2022-02-15 11:46:54 +00:00
Ian Jackson
97a0a7359b
tor-socksproto: Use bad_api_usage! rather than ad-hoc Invalid error
2022-02-15 11:40:24 +00:00
Ian Jackson
b8f928e4f5
Make Bug from InternalError, add bad_api_usage! and into_bad_api_usage!
...
Including supporting machinery, new kind field, etc.
2022-02-15 11:40:24 +00:00
Ian Jackson
5d87ca8ad7
New name and semantics for BadAPIUsage (was BadArgument)
2022-02-15 11:32:19 +00:00
Nick Mathewson
e80d472beb
Merge branch 'error-socksproto-autoconvert' into 'main'
...
Provide, and use From impl for InternalError
See merge request tpo/core/arti!315
2022-02-14 20:57:24 +00:00
Nick Mathewson
72221b0b77
Merge branch 'explain_into_tor_addr' into 'main'
...
More docs for IntoTorAddr
Closes #253
See merge request tpo/core/arti!305
2022-02-14 20:34:50 +00:00
Nick Mathewson
a44b13c93a
More docs for IntoTorAddr
2022-02-14 20:34:50 +00:00
Nick Mathewson
31075e8046
Run rustfmt.
2022-02-14 14:47:42 -05:00
eta
d7478e2675
Merge branch 'ticket_337' into 'main'
...
Simplify wait_for_bootstrap to use a Mutex.
Closes #337
See merge request tpo/core/arti!308
2022-02-14 19:46:23 +00:00
eta
29daf5a74a
Merge branch 'warn_not_deny' into 'main'
...
Change deny(clippy::all) to warn(clippy::all).
Closes #338
See merge request tpo/core/arti!306
2022-02-14 19:45:18 +00:00
Nick Mathewson
e4321bbae2
Merge remote-tracking branch 'origin/mr/313'
2022-02-14 14:25:28 -05:00
Ian Jackson
8db7ab8148
Merge branch 'error-kind-protocol' into 'main'
...
Split up ErrorKind::ProtocolViolation
See merge request tpo/core/arti!312
2022-02-14 19:07:00 +00:00
Ian Jackson
4774cbd18d
Provide, and use From impl for InternalError
...
Adding this autoconversion is quite safe since every error generation
site is explicit and has its own context, and we don't really need to
add more.
This simplifies the code and will simplify future work.
2022-02-14 18:48:35 +00:00
Ian Jackson
65e2deaf29
Merge branch 'error-kind-notimp' into 'main'
...
Split up ErrorKind::NoSupport
See merge request tpo/core/arti!311
2022-02-14 18:31:56 +00:00
Nick Mathewson
b6d23c36be
Refactor tor_netdoc::Error
...
This error type doesn't impement HasKind, since the kind will depend
on context.
However, the existing implementation was pretty messy and inconsistent:
Some errors had positions, some didn't.
Some took messages as str, some as String.
Some had internal errors that were somewhat orthogonal to their actual
types.
This commit refactors tor_netdoc::Error to use a ParseErrorKind, and
adds a set of convenience functions to add positions and
messages to the errors that need them.
2022-02-14 13:08:28 -05:00
Ian Jackson
4d14398fe1
Split up ErrorKind::ProtocolViolation
2022-02-14 17:55:56 +00:00
Ian Jackson
b74f3a3c10
ErrorKind::NotImplemented: fix two tests
2022-02-14 17:54:05 +00:00
Ian Jackson
02959576bb
tor_socksproto::Error HasKind fix two delegations
...
We should not generally explicitly specify a kind for errors which
contain a more detailed error which itself has a kind. Stating the
kind literally is a latent bug, which becomes a real bug if the
contained type's kind changes or starts to vary.
(There may be exceptions to this principle but this isn't one of
them.)
2022-02-14 17:46:19 +00:00
Nick Mathewson
9e88f279d9
Merge branch 'error-kind-config-transition' into 'main'
...
Clarify ErrorKind::InvalidConfigTransition
See merge request tpo/core/arti!309
2022-02-14 16:51:32 +00:00