summaryrefslogtreecommitdiff
path: root/crates/tor-dirmgr/src/err.rs
Commit message (Collapse)AuthorAgeFilesLines
* tor-persist: Provide FsMistrustErrorExt, and use itIan Jackson2023-12-131-7/+2
| | | | | | | | | | | | | This code needs fs_mistrust::Error and tor_error::ErrorKind. I think we probably don't want fs_mistrust to depend on tor_error or vice versa. tor_persist is approximately the place where these two threads of thought come together, and it's currently the lowest place where this is needed. Use it in tor-dirmgr too, which is currently the other place that embodies this knowledge about fs_mistrust::Error.
* tor-dirmgr: impl AsRef<dyn Error> for ErrorIan Jackson2022-11-041-0/+7
| | | | This allows use with tor_error::Report.
* `TaskSchedule`: give error on `sleep*()` if last handle is droppedNick Mathewson2022-09-071-0/+10
| | | | | | | | | | | | | | | | | | This fixes an busy-loop. When the last `TaskHandle` on a `TaskSchedule` is dropped, the schedule is permanently canceled: whatever operation it was scheduling should no longer be performed. But our code was broken: the `sleep()` and `sleep_until_wallclock()` functions don't verify whether the handles are dropped or not. This breakage caused an CPU-eating busy-loop in `sleep_until_wallclock`. With this patch, we now return a `Result<(), SleepError>` from these functions. Fixes #572.
* Use anonymize_home() when displaying various messages.Nick Mathewson2022-08-311-1/+2
| | | | Closes #555
* dirmgr: Add a helper to create LockFile errors.Nick Mathewson2022-07-181-0/+6
|
* dirmgr: Make UnrecognizedSchema more helpfulNick Mathewson2022-07-141-5/+10
|
* dirmgr: Clarify disk IO errors.Nick Mathewson2022-07-141-18/+20
|
* dirmgr: style edits to error messages.Nick Mathewson2022-07-141-22/+22
|
* Do not include error source() in display() format.Nick Mathewson2022-06-211-6/+6
| | | | | | | | | According to doc/Errors.md, and in keeping with current best practices, we should not include display an error's `source()` as part of that error's display method. Instead, we should let the caller decide to call source() and display that error in turn. Part of #323.
* DirMgr:: Remove Error::NoChange as redundant.Nick Mathewson2022-05-251-12/+2
| | | | | | | | Now that the relevant functions now report changed/not-changed status via a boolean out-parameter (see !527), there's no reason to have a separate NoChanged error case. Closes #484.
* Remove BootstrapAction::ImpossibleNick Mathewson2022-05-191-5/+2
| | | | It does nothing that Fatal does not. Suggested by @eta in review.
* DirMgr: Start refactoring error handling.Nick Mathewson2022-05-171-2/+92
| | | | | | This commit adds a couple of new error types that we will soon want to distinguish, and a new way of classifying errors. These are not yet all used.
* On a blocking error, blame the appropriate directory cacheNick Mathewson2022-05-161-0/+12
| | | | | Fortunately, the only error type that we need to handle blocking errors with actually has a DirSource in it already.
* Delete tor_dirmgr::Error::BadNetworkConfigIan Jackson2022-05-121-5/+0
| | | | | | | | | This was anomalous, in that it contains &'static str, rather than a proper nested error (eg a config::ConfigError, maybe). But in fact it tursn out it is now not constructed. The last construction site was removed a long time ago in Use derive_builder for Authority and FallbackDir.
* tor-dirmgr/bootstrap.rs: error on older netdirs, add log lineeta2022-05-101-0/+5
| | | | | | | | - We don't want to inadvertently replace our netdir with one that's actually older, so detect and error on this condition. - Also, print a debug line when we get a new netdir without enough guards. - (An unrelated TODO was also added.)
* Update tor-dirmgr to use fs-mistrust.Nick Mathewson2022-05-091-0/+11
|
* Fix typosSamanta Navarro2022-04-201-1/+1
| | | | Typos found with codespell.
* Treat expired/not-yet-valid directory objects as Errors.Nick Mathewson2022-04-051-1/+6
| | | | | | | | | | | | | Doing this will make us treat caches that send us these objects as not-working, and close circuits to them instead of trying over and over. The case where we add a document from the cache requires special handling: it isn't actually a error to find an expired document in our cache (unless the passage of time itself is erroneous, which is a debatable proposition at best). Fixes #431.
* Expand some comments based on review from @diziet.Nick Mathewson2022-03-211-0/+6
|
* dirmgr: Note errors and inform the circmgr about them.Nick Mathewson2022-03-211-0/+41
| | | | | | Some error types indicate that the guard has failed as a dircache. We should treat these errors as signs to close the circuit, and to mark the guard as having failed.
* Provide an error variant for external directory providersIan Jackson2022-03-041-0/+12
|
* Rename TorConnectionFailed to TorAccessFailedNick Mathewson2022-02-221-1/+1
|
* Rename TorShuttingDown to ArtiShuttingDownNick Mathewson2022-02-221-1/+1
|
* Use TorConnectionFailed for failure to download directory.Nick Mathewson2022-02-171-1/+1
|
* tor-dirmgr: Use Bug type for sqlite-detected bugsIan Jackson2022-02-171-1/+9
| | | | So we get a stack trace
* tor-dirmgr: Make sqlite_error_kind take rusqlite::ErrorIan Jackson2022-02-171-32/+34
| | | | | We're about to reuse this and we'll want it to take the higher-level type. Also it seems more proper like this.
* dirmgr: Remember where netdocs came from.Nick Mathewson2022-02-161-3/+20
| | | | | This isn't complete (see TODO), but it's enough to let us report the right ErrorKind if something fails to parse.
* dirmgr: eliminate StringParsingError.Nick Mathewson2022-02-161-23/+13
| | | | | | | | It had too many possible Kinds depending on what kind of string had failed to parse. I decided to use #[source] here instead of #[from], so that we would have to explicitly convert these errors where they show up.
* dirmgr: HasKind for internal and sqlite errorsNick Mathewson2022-02-161-11/+51
| | | | | At first I had thought that all sqlite errors would be internal, but that's not the case.
* dirmgr: implement HasKind for the easier variantsNick Mathewson2022-02-161-9/+30
|
* Allow creating unbootstrapped `TorClient`s (and `DirMgr`s)eta2022-02-111-0/+3
| | | | | | | | | | | | | | | 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
* Make SpawnError wrappers contain a 'spawning' stringNick Mathewson2022-02-041-5/+15
| | | | | (By our convention, these errors should say what we were trying to spawn when the error occurred.)
* Make TorError implement Clone.Nick Mathewson2022-02-041-4/+22
| | | | | This patch makes only minimal changes in lower-level error types: we have more refactoring to do.
* spawn errors: Fix tor-dirmgrIan Jackson2022-02-041-3/+10
|
* Fix some typos in comments.Nick Mathewson2021-10-191-1/+1
| | | | Also, tell the "typos" tool to ignore Cargo.lock.
* Remove anyhow dependency from tor-dirmgr.Jani Monoses2021-10-181-0/+48
|
* Move all crates into a `crates` subdirectory.Nick Mathewson2021-08-271-0/+51
This will cause some pain for now, but now is really the best time to do this kind of thing.