summaryrefslogtreecommitdiff
path: root/crates/tor-error/src
Commit message (Collapse)AuthorAgeFilesLines
* tor-proto: better errors when handshake fails due to untimely certsNick Mathewson2022-03-231-0/+8
| | | | | | | | | | | | | | | | | | 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.
* Provide ErrorKind::OtherIan Jackson2022-03-041-0/+10
|
* Merge branch 'clippy-allow-arc-clone' into 'main'Nick Mathewson2022-03-011-1/+0
|\ | | | | | | | | Disable clippy::clone_on_ref_ptr See merge request tpo/core/arti!352
| * Disable clippy::clone_on_ref_ptrIan Jackson2022-02-241-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Fix typo in messageNick Mathewson2022-02-281-1/+1
| |
* | EK::RemoteProtocolFailed replaces OtherRemoteIan Jackson2022-02-281-6/+14
| | | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/355#note_2781816
* | Introduce ErrorKind::OtherRemoteIan Jackson2022-02-281-0/+9
| | | | | | | | | | | | | | | | | | | | 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.
* | Merge branch 'proto_handshake_err' into 'main'Nick Mathewson2022-02-241-2/+2
|\ \ | | | | | | | | | | | | | | | | | | tor-proto: Split up a couple of handshake-based errors Closes #359 and #358 See merge request tpo/core/arti!344
| * | tor-proto: Split IoErr based on when it occursNick Mathewson2022-02-231-2/+2
| |/ | | | | | | | | | | | | We want to distinguish handshake failures from errors later on in the channel's lifetime. Closes #359.
* / Give specific error kinds to different END reasonsNick Mathewson2022-02-231-1/+53
|/ | | | Closes #360.
* Cleanups on !340 from @dizietIan Jackson2022-02-231-2/+8
|
* Make NoLock into BadApiUsage.Nick Mathewson2022-02-221-12/+0
| | | | | | 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.
* Eliminate RequestedResourceAbsent kind.Nick Mathewson2022-02-221-7/+0
| | | | | | | | 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.
* Fold NamespaceFull into BadApiUsage.Nick Mathewson2022-02-221-12/+0
|
* Rename RemoteNameError to RemoteHostNotFoundNick Mathewson2022-02-221-4/+4
| | | | | 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.
* Replace TorNetworkError with TorDirectoryErrorNick Mathewson2022-02-221-6/+6
| | | | | | 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.
* Rename TorConnectionFailed to TorAccessFailedNick Mathewson2022-02-221-1/+1
|
* Fold UnexplainedTaskSpawnFailure into Internal.Nick Mathewson2022-02-221-9/+1
|
* Rename TorShuttingDown to ArtiShuttingDownNick Mathewson2022-02-221-1/+1
|
* Replace RemoteRefused with CircuitRefused.Nick Mathewson2022-02-221-4/+4
| | | | Also document that it's a lower-level error kind.
* Rename RemoteIdMismatch to RelayIdMismatch.Nick Mathewson2022-02-221-2/+2
|
* Fold EK::Canceled into TransientFailureNick Mathewson2022-02-221-10/+0
| | | | Also add some TODO comments in circmgr for future work.
* Fold AlreadyClosed into BadApiUsageNick Mathewson2022-02-221-5/+0
|
* Add TODOs for errorkinds we mean to fix laterNick Mathewson2022-02-221-2/+13
| | | | | Per #348, These are the cases that we meant to fix down the road, but not in 0.1.0.
* Merge remote-tracking branch 'origin/mr/335'Nick Mathewson2022-02-221-18/+39
|\
| * Edit tor-error comment to reflect shared ideasNick Mathewson2022-02-181-18/+37
| |
* | Merge branch 'error-report' into 'main'Nick Mathewson2022-02-222-0/+118
|\ \ | | | | | | | | | | | | Improve error messages from arti cli See merge request tpo/core/arti!331
| * | tor_error::Report: add testsIan Jackson2022-02-221-0/+56
| | |
| * | tor_error::Report: Add bound to structIan Jackson2022-02-221-1/+3
| | | | | | | | | | | | | | | This is more typing in the definition but it produces much better error messages if you try to Report(foo).to_string()
| * | Move program name printing to report_and_exitIan Jackson2022-02-221-3/+8
| | |
| * | Placate clippy on nightly, properlyIan Jackson2022-02-181-1/+1
| | | | | | | | | | | | | | | 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 _.
| * | Placate clippy on nightlyIan Jackson2022-02-181-0/+1
| | |
| * | Placate rustfmtIan Jackson2022-02-181-4/+10
| | | | | | | | | | | | I think all of this diff is a strict disimprovement, but whatever.
| * | Placate clippyIan Jackson2022-02-181-1/+3
| | |
| * | Add missing docs for report_and_exitIan Jackson2022-02-181-0/+3
| | |
| * | Provide error reporter and use it in the arti binaryIan Jackson2022-02-182-0/+43
| |/
* / Fix typosDimitris Apostolou2022-02-181-2/+2
|/
* spelling fixNick Mathewson2022-02-171-1/+1
|
* Add #[display] annotations for remaining ErrorKinds.Nick Mathewson2022-02-171-0/+2
|
* Merge branch 'remaining-errors'Nick Mathewson2022-02-171-16/+174
|\
| * Use TorConnectionFailed for failure to download directory.Nick Mathewson2022-02-171-8/+0
| |
| * Clarify state vs cache in ErrorKindNick Mathewson2022-02-171-4/+20
| |
| * Correct ErrorKinds for some tor-dirclient errors.Nick Mathewson2022-02-171-0/+8
| |
| * Rename CircuitTimeout to TorNetworkTimeout.Nick Mathewson2022-02-171-4/+5
| |
| * Rename ExitTimeout to RemoteNetworkTimeout.Nick Mathewson2022-02-171-1/+1
| |
| * Tweak documentation on ErrorKind::TransientNick Mathewson2022-02-171-5/+4
| |
| * tor-error: splitting/lumping guidelinesIan Jackson2022-02-171-0/+32
| |
| * ErrorKind::RemoteRefused: Expand on description, narrowing scopeIan Jackson2022-02-171-0/+3
| |
| * ErrorKind::Csnceled: Expand on descriptionIan Jackson2022-02-171-0/+3
| |
| * ErrorKind::CircuitTimeout: Expand on descriptionIan Jackson2022-02-171-1/+2
| |