Commit Graph

225 Commits

Author SHA1 Message Date
Ian Jackson 589c6e52bb Run maint/add_warning crates/*/src/{lib,main}.rs
Update all lint blocks
2022-06-23 19:15:42 +01:00
Ian Jackson abea103bb0 tor-error: Fix a broken intra-doc link
I didn't spot this in review amongst the other messages from Nightly.
2022-06-10 13:45:30 +01:00
trinity-1686a 6c6998a65b try to differentiate transient from nontransient error 2022-06-08 16:02:01 +01:00
Ian Jackson fec706c2f3 lints: Make lint blocks consistent
The remaining consequences of running add_warning
2022-05-31 15:24:11 +01:00
Ian Jackson 4f42101554 lints: Add let_unit_value allow to all crates
From running add_warning, with manual picking of the right
hunks/lines.
2022-05-31 15:23:52 +01:00
Ian Jackson ba0843da4a lints: Add lint block delimiters to every crate
This was the result of:
  maint/add_warning crates/*/src/{lib,main}.rs
and then manually curating the results.
2022-05-31 13:00:31 +01:00
Nick Mathewson 9d36925700 Move tor-error crate to the "rust-patterns" category.
There is no "tor" category; crates.io warned about this.
2022-05-27 14:02:17 -04:00
Nick Mathewson b232365a75 Semantic version changes for Arti 0.4.0 release
I followed the following procedure to make these changes:

* I used maint/changed_crates to find out which crates had changed
  since 0.3.0.
* I used grep and maint/list_crates to sort those crates in
  topological (dependency) order.
* I looked through semver_status to find which crates were listed as
  having semver-relevant changes (new APIs and breaking changes).
* I scanned through the git logs of the crates with no
  semver-relevant changes listed to confirm that, indeed, they had
  no changes.  For those crates, I incremented their patch-level
  version _without_ changing the version that other crates depend on.
* I scanned through the git logs of the crates with no
  semver-relevant changes listed to confirm that, indeed, they had
  no obvious breaking changes.
* I treated all crates that depend on `arti` and/or `arti-client` as
  having breaking changes.
* I identified crates that depend on crates that have changed, even
  if they have not changed themselves, and identified them as having
  a non-breaking change.
* For all of the crates, I used `cargo set-version -p $CRATE --bump
  $STATUS` (where `STATUS` is `patch` or `minor`) to update the
  versions, and the depended-upon versions.
2022-05-27 09:01:20 -04:00
Ian Jackson 273879cb14 Placate rustfmt
I found the previous layout *much* better.  Ah well.
2022-05-17 15:04:10 +01:00
Ian Jackson 298b2421f0 Do backtrace string matching test only on some platforms.
"Fixes" #455 by suppressing the test.

This is !509 redux.
2022-05-17 15:03:46 +01:00
eta 9d8ce43298 Revert "Merge branch 'backtrace' into 'main'"
This reverts merge request !509
2022-05-16 15:01:02 +00:00
Ian Jackson 777b2c123f Do backtrace string matching test only on Linux
"Fixes" #455 by suppressing the test.
2022-05-16 15:00:43 +00:00
Nick Mathewson 4262e9d0ec Merge branch 'use-fs-mistrust' 2022-05-09 15:27:25 -04:00
Nick Mathewson 8509ffff7a Add new FsPermissions ErrorKind. 2022-05-09 14:40:29 -04:00
Nick Mathewson 7b93091f57 Bump the version of every* crate to 0.3.0
* Except for safelog and fs-mistrust, which are new.
2022-05-06 10:03:15 -04:00
Samanta Navarro c53818d496 Fix grammar and typos 2022-04-27 13:52:13 +01:00
Nick Mathewson c1ea419477 Merge branch 'main' into 'msrv_1_56'
# Conflicts:
#   crates/tor-config/Cargo.toml
#   crates/tor-dirmgr/src/state.rs
#   doc/semver_status.md
2022-04-26 12:45:16 +00:00
Ian Jackson 15dd7cbdd3 AbsRetryTime::from_sum: Provide a test case
As requested in
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/470#note_2798015
2022-04-25 18:39:11 +01:00
Ian Jackson 2d9b50540d AbsRetryTime::from_sum: Add missing full stop
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/470#note_2797945
2022-04-25 18:37:14 +01:00
Nick Mathewson b60b0a266a Bump every crate's edition to 2021.
This is an automated change made with a perl one-liner and verified
with grep -L and grep -l.

Some warnings are introduced with this change; they will be removed
in subsequent commits.

See arti#208 for older discussion on this issue.
2022-04-25 13:05:31 -04:00
Nick Mathewson ca05b0904c Add 'rust-version = "1.56"' to every Cargo.toml file.
This change was made automatically with a perl one-liner, and
confirmed with `grep -L`.

The `rust-version` field itself was introduced in 1.56.0.
2022-04-25 13:04:31 -04:00
Ian Jackson 07de58370e retry-error: Provide AbsRetryTime::from_sub and use it
This same calculation was in the code three times.
2022-04-25 10:42:52 +01:00
Samanta Navarro 77653608d6 tor-error: Handle integer overflows
If duration addition overflows, then continue with Never.

Caching the AbsRetryTime constructed with duration from supplied
function also reduces the overhead of earliest_absolute.
2022-04-23 13:33:00 +00:00
Nick Mathewson 414763b6e2 RetryTime: Improve documentation.
For each case, describe its semantics (in addition to when you would
create it).

Explain the relationship between After and At.

Stop saying "Strategy": we renamed this type to "RetryTime".
2022-04-04 11:22:40 -04:00
Nick Mathewson 81ebbc8e74 RetryTime: make loose_cmp pub. 2022-04-04 11:15:18 -04:00
Nick Mathewson 160cb91669 RetryTime: use strum::EnumDiscriminants to simplify loose_cmp.
Also add tests for RetryTime comparison functions to make sure they
work as expected.
2022-04-04 11:15:18 -04:00
Nick Mathewson 3676826d03 tor-error: Add a new RetryTime type and related trait. 2022-04-04 11:09:25 -04:00
Nick Mathewson a044d4bcfe Reformat tor-error/Cargo.toml 2022-04-04 11:09:25 -04:00
Nick Mathewson 5b2fc118df Bump all arti*, tor* crates to 0.2.0
Not all of these strictly need to be bumped to 0.2.0; many could go
to 0.1.1 instead.  But since everything at the tor-rtcompat and
higher layers has had breaking API changes, it seems not so useful
to distinguish.  (It seems unlikely that anybody at this stage is
depending on e.g. tor-protover but not arti-client.)
2022-04-01 09:15:18 -04:00
Nick Mathewson 0b2cf533ee tor-proto: better errors when handshake fails due to untimely certs
We now check the handshake certificates unconditionally, and only
report them as _expired_ as a last resort.

(Rationale: if somebody is presenting the wrong identity from a year
ago, it is more interesting that they are presenting the wrong ID
than it is that they are doing so with an expired cert.

We also now report a different error if the certificate is expired,
but its expiration is within the range of reported clock skew.

(Rationale: it's helpful to distinguish this case, so that we can
blame the failure on possible clock skew rather than definitely
attributing it to a misbehaving relay.)

Part of #405.
2022-03-23 08:24:36 -04:00
Ian Jackson 055b7399f2 Provide ErrorKind::Other 2022-03-04 17:35:34 +00:00
Nick Mathewson 83c8b11c2c Merge branch 'clippy-allow-arc-clone' into 'main'
Disable clippy::clone_on_ref_ptr

See merge request tpo/core/arti!352
2022-03-01 20:38:05 +00:00
Nick Mathewson e8e9791a97 Bump all crates to 0.1.0 2022-03-01 08:59:34 -05:00
Nick Mathewson 5735222691 Update README.md files from rustdoc. 2022-03-01 08:30:53 -05:00
Nick Mathewson ec25f68b9b Fix typo in message 2022-02-28 14:47:25 +00:00
Ian Jackson 8898bbb421 EK::RemoteProtocolFailed replaces OtherRemote
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/355#note_2781816
2022-02-28 13:27:44 +00:00
Ian Jackson c08a317093 Introduce ErrorKind::OtherRemote
arti-hyper wants to be able to have a kind for TLS failure.

Given that arti-hyper is above arti-client, this shows that callers
above arti-client might need to invent kinds for their own errors.

Possibly this means we need other Other errors for other locations.
If we have pluggable components we might even want OtherTorError.
2022-02-28 13:07:44 +00:00
Nick Mathewson 326e77c66c Update minimum backtrace version to 0.3.39
This is needed to make the backtrace test pass on Rust 1.53 with
minimum-version libraries.
2022-02-25 11:09:24 -05:00
Nick Mathewson 7f3ea03e58 Merge branch 'proto_handshake_err' into 'main'
tor-proto: Split up a couple of handshake-based errors

Closes #359 and #358

See merge request tpo/core/arti!344
2022-02-24 19:44:34 +00:00
Ian Jackson afb50fe735 Disable clippy::clone_on_ref_ptr
This lint is IMO inherently ill-conceived.

I have looked for the reasons why this might be thought to be a good
idea and there were basically two (and they are sort of contradictory):

I. "Calling ‘.clone()` on an Rc, Arc, or Weak can obscure the fact
    that only the pointer is being cloned, not the underlying data."

This is the wording from
  https://rust-lang.github.io/rust-clippy/v0.0.212/#clone_on_ref_ptr

It is a bit terse; we are left to infer why it is a bad idea to
obscure this fact.  It seems to me that if it is bad to obscure some
fact, that must be because the fact is a hazard.  But why would it be
a hazard to not copy the underlying data ?

In other languages, faliing to copy the underlying data is a serious
correctness hazard.  There is a whose class of bugs where things were
not copied, and then mutated and/or reused in multiple places in ways
that were not what the programmer intended.  In my experience, this is
a very common bug when writing Python and Javascript.  I'm told it's
common in golang too.

But in Rust this bug is much much harder to write.  The data inside an
Arc is immutable.  To have this bug you'd have use interior mutability
- ie mess around with Mutex or RefCell.  That provides a good barrier
to these kind of accidents.

II. "The reason for writing Rc::clone and Arc::clone [is] to make it
     clear that only the pointer is being cloned, as opposed to the
     underlying data. The former is always fast, while the latter can
     be very expensive depending on what is being cloned."

This is the reasoning found here
  https://github.com/rust-lang/rust-clippy/issues/2048

This is saying that *not* using Arc::clone is hazardous.
Specifically, that a deep clone is a performance hazard.

But for this argument, the lint is precisely backwards.  It's linting
the "good" case and asking for it to be written in a more explicit
way; while the supposedly bad case can be written conveniently.

Also, many objects (in our codebase, and in all the libraries we use)
that are Clone are in fact simply handles.  They contain Arc(s) (or
similar) and are cheap to clone.  Indeed, that is the usual case.

It does not make sense to distinguish in the syntax we use to clone
such a handle, whether the handle is a transparent Arc, or an opaque
struct containing one or more other handles.

Forcing Arc::clone to be written as such makes for code churn when a
type is changed from Arc<Something> to Something: Clone, or vice
versa.
2022-02-24 18:15:44 +00:00
Nick Mathewson afa49eac8f tor-proto: Split IoErr based on when it occurs
We want to distinguish handshake failures from errors later on in
the channel's lifetime.

Closes #359.
2022-02-23 10:38:48 -05:00
Nick Mathewson 6c615898e4 Give specific error kinds to different END reasons
Closes #360.
2022-02-23 09:35:28 -05:00
Ian Jackson 05bf12edfa Cleanups on !340 from @diziet 2022-02-23 13:17:27 +00:00
Nick Mathewson 784f1531bb Make NoLock into BadApiUsage.
To implement this, we had to refactor the tor_circmgr api for
flushing state changes to disk, so that it checks if it has the lock,
and only then tries to store.
2022-02-22 16:13:37 -05:00
Nick Mathewson a2e2663e90 Eliminate RequestedResourceAbsent kind.
There was only one use of this, and it was in as-yet-unused relay-only
code.

Removing this type required refactoring the relay onion handshake code
to use its own error type, which is probably clever anyway.
2022-02-22 16:00:25 -05:00
Nick Mathewson 789e6c87b8 Fold NamespaceFull into BadApiUsage. 2022-02-22 15:44:49 -05:00
Nick Mathewson 4cedc1a190 Rename RemoteNameError to RemoteHostNotFound
This is a bit ugly but we need it to work around the problem where
exits aren't always clear about _why_ a hostname lookup failed.
2022-02-22 15:43:27 -05:00
Nick Mathewson 0ce4a12976 Replace TorNetworkError with TorDirectoryError
This is still not as specific as we want; but there's already a TODO
comment in tor-dirclient::err about fixing that at some point in the
future.
2022-02-22 15:41:01 -05:00
Nick Mathewson 7d4a57d5fa Rename TorConnectionFailed to TorAccessFailed 2022-02-22 15:38:13 -05:00
Nick Mathewson 3f0d50e08f Fold UnexplainedTaskSpawnFailure into Internal. 2022-02-22 15:37:22 -05:00
Nick Mathewson 0e242831b2 Rename TorShuttingDown to ArtiShuttingDown 2022-02-22 15:36:09 -05:00
Nick Mathewson 0d079071fe Replace RemoteRefused with CircuitRefused.
Also document that it's a lower-level error kind.
2022-02-22 15:34:46 -05:00
Nick Mathewson f018d0c74b Rename RemoteIdMismatch to RelayIdMismatch. 2022-02-22 15:32:08 -05:00
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