summaryrefslogtreecommitdiff
path: root/crates/tor-error
Commit message (Collapse)AuthorAgeFilesLines
* Bump crate and dependency versions.Nick Mathewson2022-06-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These were done with the following commands: ``` cargo set-version -p tor-basic-utils --bump patch cargo set-version -p fs-mistrust --bump minor cargo set-version -p tor-error --bump patch cargo set-version -p tor-config --bump patch cargo set-version -p tor-units --bump patch cargo set-version -p tor-rtcompat --bump minor cargo set-version -p tor-llcrypto --bump patch cargo set-version -p tor-bytes --bump minor cargo set-version -p tor-socksproto --bump minor cargo set-version -p tor-cert --bump minor cargo set-version -p tor-cell --bump minor cargo set-version -p tor-proto --bump minor cargo set-version -p tor-netdoc --bump patch cargo set-version -p tor-netdir --bump minor cargo set-version -p tor-persist --bump patch cargo set-version -p tor-chanmgr --bump minor cargo set-version -p tor-guardmgr --bump minor cargo set-version -p tor-circmgr --bump patch cargo set-version -p tor-dirclient --bump patch cargo set-version -p tor-dirmgr --bump minor cargo set-version -p arti-client --bump patch cargo set-version -p arti --bump minor cargo set-version -p arti-bench --bump minor cargo set-version -p arti-testing --bump minor ```
* Run maint/add_warning crates/*/src/{lib,main}.rsIan Jackson2022-06-231-0/+3
| | | | Update all lint blocks
* tor-error: Fix a broken intra-doc linkIan Jackson2022-06-101-1/+2
| | | | I didn't spot this in review amongst the other messages from Nightly.
* try to differentiate transient from nontransient errortrinity-1686a2022-06-081-1/+8
|
* lints: Make lint blocks consistentIan Jackson2022-05-311-0/+1
| | | | The remaining consequences of running add_warning
* lints: Add let_unit_value allow to all cratesIan Jackson2022-05-311-0/+1
| | | | | From running add_warning, with manual picking of the right hunks/lines.
* lints: Add lint block delimiters to every crateIan Jackson2022-05-311-0/+2
| | | | | | This was the result of: maint/add_warning crates/*/src/{lib,main}.rs and then manually curating the results.
* Move tor-error crate to the "rust-patterns" category.Nick Mathewson2022-05-271-1/+1
| | | | There is no "tor" category; crates.io warned about this.
* Semantic version changes for Arti 0.4.0 releaseNick Mathewson2022-05-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Placate rustfmtIan Jackson2022-05-171-5/+1
| | | | I found the previous layout *much* better. Ah well.
* Do backtrace string matching test only on some platforms.Ian Jackson2022-05-171-0/+19
| | | | | | "Fixes" #455 by suppressing the test. This is !509 redux.
* Revert "Merge branch 'backtrace' into 'main'"eta2022-05-161-6/+0
| | | This reverts merge request !509
* Do backtrace string matching test only on LinuxIan Jackson2022-05-161-0/+6
| | | | "Fixes" #455 by suppressing the test.
* Merge branch 'use-fs-mistrust'Nick Mathewson2022-05-091-0/+9
|\
| * Add new FsPermissions ErrorKind.Nick Mathewson2022-05-091-0/+9
| |
* | Bump the version of every* crate to 0.3.0Nick Mathewson2022-05-061-1/+1
|/ | | | * Except for safelog and fs-mistrust, which are new.
* Fix grammar and typosSamanta Navarro2022-04-274-4/+4
|
* Merge branch 'main' into 'msrv_1_56'Nick Mathewson2022-04-261-12/+29
|\ | | | | | | | | | | # Conflicts: # crates/tor-config/Cargo.toml # crates/tor-dirmgr/src/state.rs # doc/semver_status.md
| * AbsRetryTime::from_sum: Provide a test caseIan Jackson2022-04-251-0/+15
| | | | | | | | | | As requested in https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/470#note_2798015
| * AbsRetryTime::from_sum: Add missing full stopIan Jackson2022-04-251-1/+1
| | | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/470#note_2797945
| * retry-error: Provide AbsRetryTime::from_sub and use itIan Jackson2022-04-251-12/+14
| | | | | | | | This same calculation was in the code three times.
* | Bump every crate's edition to 2021.Nick Mathewson2022-04-251-1/+1
| | | | | | | | | | | | | | | | | | | | 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.
* | Add 'rust-version = "1.56"' to every Cargo.toml file.Nick Mathewson2022-04-251-0/+1
|/ | | | | | | 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.
* tor-error: Handle integer overflowsSamanta Navarro2022-04-231-4/+27
| | | | | | | If duration addition overflows, then continue with Never. Caching the AbsRetryTime constructed with duration from supplied function also reduces the overhead of earliest_absolute.
* RetryTime: Improve documentation.Nick Mathewson2022-04-041-7/+27
| | | | | | | | | 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".
* RetryTime: make loose_cmp pub.Nick Mathewson2022-04-041-1/+1
|
* RetryTime: use strum::EnumDiscriminants to simplify loose_cmp.Nick Mathewson2022-04-042-26/+70
| | | | | Also add tests for RetryTime comparison functions to make sure they work as expected.
* tor-error: Add a new RetryTime type and related trait.Nick Mathewson2022-04-043-0/+221
|
* Reformat tor-error/Cargo.tomlNick Mathewson2022-04-041-3/+3
|
* Bump all arti*, tor* crates to 0.2.0Nick Mathewson2022-04-011-1/+1
| | | | | | | | 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.)
* 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.
* | Bump all crates to 0.1.0arti-v0.1.0Nick Mathewson2022-03-011-1/+1
| |
* | Update README.md files from rustdoc.Nick Mathewson2022-03-011-16/+5
| |
* | 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.
* | Update minimum backtrace version to 0.3.39Nick Mathewson2022-02-251-1/+1
| | | | | | | | | | This is needed to make the backtrace test pass on Rust 1.53 with minimum-version libraries.
* | 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
|