Nick Mathewson
04ca1f662f
Fold EK::Canceled into TransientFailure
...
Also add some TODO comments in circmgr for future work.
2022-02-22 15:30:12 -05:00
Nick Mathewson
5351aaa308
Fold AlreadyClosed into BadApiUsage
2022-02-22 15:25:24 -05:00
Nick Mathewson
a02737be1c
Add TODOs for errorkinds we mean to fix later
...
Per #348 , These are the cases that we meant to fix down the road, but
not in 0.1.0.
2022-02-22 15:22:49 -05:00
Nick Mathewson
e62afdf79a
Merge remote-tracking branch 'origin/mr/335'
2022-02-22 12:46:51 -05:00
Nick Mathewson
4d4c7f47a7
Merge branch 'error-report' into 'main'
...
Improve error messages from arti cli
See merge request tpo/core/arti!331
2022-02-22 17:31:18 +00:00
Ian Jackson
be2bb0ccfb
tor_error::Report: add tests
2022-02-22 14:57:16 +00:00
Ian Jackson
01c5e07087
tor_error::Report: Add bound to struct
...
This is more typing in the definition but it produces much better
error messages if you try to Report(foo).to_string()
2022-02-22 14:53:17 +00:00
Ian Jackson
06964bbfbb
Move program name printing to report_and_exit
2022-02-22 14:52:47 +00:00
Ian Jackson
7d403b42fe
Placate clippy on nightly, properly
...
I c&p this lint suppression but from a cli option printed by clippy,
and I didn't notice the need to change the - to _.
2022-02-18 18:07:43 +00:00
Nick Mathewson
0513a1d8a6
Edit tor-error comment to reflect shared ideas
2022-02-18 12:51:05 -05:00
Ian Jackson
4182c30b63
Placate clippy on nightly
2022-02-18 17:37:21 +00:00
Dimitris Apostolou
5d61c3cf88
Fix typos
2022-02-18 15:29:02 +02:00
Ian Jackson
f5a489e28c
Placate rustfmt
...
I think all of this diff is a strict disimprovement, but whatever.
2022-02-18 12:48:17 +00:00
Ian Jackson
4a007beba7
Placate clippy
2022-02-18 12:48:00 +00:00
Ian Jackson
0eba24cb43
Add missing docs for report_and_exit
2022-02-18 12:46:58 +00:00
Ian Jackson
8c4726b55e
Provide error reporter and use it in the arti binary
2022-02-18 12:10:31 +00:00
Nick Mathewson
1572fc520e
spelling fix
2022-02-17 15:59:56 -05:00
Nick Mathewson
023ff75a64
Add #[display] annotations for remaining ErrorKinds.
2022-02-17 15:18:19 -05:00
Nick Mathewson
83d001d661
Merge branch 'remaining-errors'
2022-02-17 14:22:47 -05:00
Nick Mathewson
a5e4e24537
Use TorConnectionFailed for failure to download directory.
2022-02-17 12:37:07 -05:00
Nick Mathewson
4c08141488
Clarify state vs cache in ErrorKind
2022-02-17 12:35:35 -05:00
Nick Mathewson
024ec61a1a
Correct ErrorKinds for some tor-dirclient errors.
2022-02-17 12:26:18 -05:00
Nick Mathewson
de86ac0b0f
Rename CircuitTimeout to TorNetworkTimeout.
2022-02-17 12:22:51 -05:00
Nick Mathewson
034c5ba9f5
Rename ExitTimeout to RemoteNetworkTimeout.
2022-02-17 12:19:33 -05:00
Nick Mathewson
550eb9e61b
Tweak documentation on ErrorKind::Transient
2022-02-17 11:50:42 -05:00
Ian Jackson
9a6518fb81
tor-error: splitting/lumping guidelines
2022-02-17 13:31:11 +00:00
Ian Jackson
079f7fd1b8
ErrorKind::RemoteRefused: Expand on description, narrowing scope
2022-02-17 13:31:11 +00:00
Ian Jackson
cca253ff9f
ErrorKind::Csnceled: Expand on description
2022-02-17 13:31:11 +00:00
Ian Jackson
48e3ae6b79
ErrorKind::CircuitTimeout: Expand on description
2022-02-17 13:31:11 +00:00
Ian Jackson
de70e15f21
ErrorKind::DirectoryExpired: Add possible deprecation notes
2022-02-17 13:31:11 +00:00
Dimitris Apostolou
ea929fd942
Fix typos
2022-02-17 12:55:59 +02:00
Nick Mathewson
36314ad364
tor_error: a couple of spelling/formatting issues
2022-02-16 16:43:13 -05:00
Nick Mathewson
990753ca92
Finally remove ErrorKind::TODO.
...
Closes #322 .
2022-02-16 16:40:57 -05:00
Nick Mathewson
0bdef96897
arti_client: provide Kinds for all errors.
2022-02-16 16:38:22 -05:00
Nick Mathewson
9e03643f65
dirmgr: implement HasKind for the easier variants
2022-02-16 15:22:21 -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
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
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
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
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
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
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
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
Ian Jackson
4d14398fe1
Split up ErrorKind::ProtocolViolation
2022-02-14 17:55:56 +00:00
Ian Jackson
30ebb1358a
Split up ErrorKind::NoSupport
2022-02-14 16:06:45 +00:00
Ian Jackson
3a9a4b6532
Clarify ErrorKind::InvalidConfigTransition
2022-02-14 15:41:40 +00:00
Nick Mathewson
1cecc7e45a
Change deny(clippy::all) to warn(clippy::all).
...
Closes #338 .
2022-02-14 09:24:06 -05:00
Nick Mathewson
7885db406a
Merge branch 'eta/unbootstrapped-clients' into 'main'
...
Allow creating unbootstrapped `TorClient`s (and `DirMgr`s)
Closes #293
See merge request tpo/core/arti!298
2022-02-11 17:43:46 +00:00
eta
882e75cd28
Allow creating unbootstrapped `TorClient`s (and `DirMgr`s)
...
This commit changes how the `TorClient` type works, enabling it to be
constructed synchronously without initiating the bootstrapping process.
Daemon tasks are still started on construction (although some of them
won't do anything if the client isn't bootstrapped).
The old bootstrap() methods are now reimplemented in terms of the new
create_unbootstrapped() and bootstrap_existing() methods.
This required refactoring how the `DirMgr` works to enable the same sort
of thing there.
closes #293
2022-02-11 16:42:19 +00:00
Nick Mathewson
4e8db2b836
socksproto: Simplify Truncated handling
...
Refactor the Error type to remove the yucky internal hidden Truncated
variant. Instead, there's now an embedded tor_bytes::Error value.
If that tor_bytes::Error is Truncated, we bubble it up when we convert our
handshake result to the nested error struct.
Thus there is still (sadly) a variant of tor_socksproto::Error
that shouldn't be exposed to user code. But refactoring every
inner method under handshake.rs seemed like a bad idea: once we're using
Result<Result<..>>, the ? operator no longer helps us much.
2022-02-11 09:36:57 -05:00
Nick Mathewson
f62b2600c7
Move the Truncated error into tor-errors.
2022-02-11 09:36:57 -05:00
Nick Mathewson
f6189e174b
tor-socksproto: Implement HasKind
...
(This error isn't yet wrapped in TorError, but it will be eventually
when we implement socks proxy and PT support.)
2022-02-11 09:36:57 -05:00
Nick Mathewson
cb6de69ef6
tor-config: Add HasKind support.
...
This required a few new ErrorKinds.
2022-02-09 12:30:20 -05:00
Nick Mathewson
c43f494b44
tests for tor-error::internal
...
These tests turned up a need for using the #[track_caller]
annotation in order to get accurate locations, which is fortunately
stable since Rust 1.46.0.
2022-02-04 16:33:43 -05:00
Nick Mathewson
1166977975
Docs and clarification for a bunch of Error stuff
2022-02-04 16:06:11 -05:00
Nick Mathewson
9bd7419c20
Make the Error detail type non-exported from arti-client
...
At least by default, we should have Error be private, and not expose
it as part of our APIs.
To keep functionality in `arti`, I had to add an `ExitTimeout` error
kind.
For interface consistency, I also re-exported ErrorKind and HasError
from `arti_client`.
2022-02-04 16:06:11 -05:00
Nick Mathewson
f973fe5060
Require backtrace 0.3.8.
...
This is the first version that builds correctly on our CI. It's
from back in 2018, so requiring it shouldn't cause any major
problems.
2022-02-04 13:52:46 -05:00
Ian Jackson
87270415f0
errors: ErrorKind::TODO: Fix typo in message
...
As per
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/262#note_2772816
2022-02-04 14:46:35 +00:00
Ian Jackson
ca960df6b1
errors: Change docs for ErrorKind to refer to Arti
...
As per
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/262#note_2772810
2022-02-04 14:43:58 +00:00
Ian Jackson
f5e874cf91
errors: Drop "Error" and "Failed" from various enum variants
2022-02-04 14:42:37 +00:00
Ian Jackson
0a1cda6886
tor-chanmgr::Error: impl HasKind
2022-02-04 14:42:37 +00:00
Ian Jackson
14f67609f7
errors: Initial impl HasKind in arti-client, ErrorKind::TODO
...
This involves making a temporary ErrorKind::TODO. That will continue
to exist until all errors (at least, the ones that make it out to
here) can be properly categorised.
Introducing this will let us work from the top and bottom towards the
middle.
2022-02-04 14:42:37 +00:00
Ian Jackson
68d0ec437f
spawn errors: impl HasKind for futures::SpawnError
...
This needs two kinds. We have decided to treat a non-shutdown
SpawnError as "unexplained" rather than as an InternalError.
There are many crates whose
From<futures::task::SpawnError> for Error
erroneously treat it as an internal error. We will fix them in a moment.
2022-02-04 14:42:37 +00:00
Ian Jackson
a623982197
tor_persist::Error: impl HasKind and adjust comments
...
And change the comments to slightly reinterpret these errors, to
relate to the circumstances rather than error generation site.
2022-02-04 14:42:37 +00:00
Ian Jackson
89b0c108d7
tor-error: provide into_internal!
2022-02-04 14:42:37 +00:00
Ian Jackson
776270fee2
tor-error: Allow making an `InternalError` from some other error
...
This can be used in call sites where an error is thought not to be
possible.
The `source` will be used only for formatting messages.
2022-02-04 14:42:37 +00:00
Ian Jackson
c963bd648b
tor-error: Introduce InternalError as a type and a kind
...
This can contain a backtrace, which will be printed.
2022-02-04 14:42:37 +00:00
Ian Jackson
9e5b6fa820
tor-error: Skeleton for new crate
...
As per doc/Errors.md.
Currently there are no error kinds. Some will be added as we go along.
2022-02-04 14:33:09 +00:00