diff options
author | Gabriela Moldovan <gabi@torproject.org> | 2024-05-09 11:49:19 +0100 |
---|---|---|
committer | Gabriela Moldovan <gabi@torproject.org> | 2024-05-09 17:37:39 +0100 |
commit | f0eef5651ac3ca49fefea4bcfbaf31ab72a01e53 (patch) | |
tree | 7a596c51f80e0c5536c30e33c9f5cf0cf1522e5a | |
parent | b8a04c55b4cff32d45b4f62c408ab47e5f9eeb59 (diff) | |
download | arti-f0eef5651ac3ca49fefea4bcfbaf31ab72a01e53.tar.gz arti-f0eef5651ac3ca49fefea4bcfbaf31ab72a01e53.zip |
tor-guardmgr: Add a BootstrapRequired error for VanguardMgr.
-rw-r--r-- | crates/tor-guardmgr/src/vanguards/err.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/crates/tor-guardmgr/src/vanguards/err.rs b/crates/tor-guardmgr/src/vanguards/err.rs index e7ea31484..b89b1311d 100644 --- a/crates/tor-guardmgr/src/vanguards/err.rs +++ b/crates/tor-guardmgr/src/vanguards/err.rs @@ -11,6 +11,14 @@ use crate::vanguards::Layer; #[derive(Clone, Debug, thiserror::Error)] #[non_exhaustive] pub enum VanguardMgrError { + /// Attempted to use an unbootstrapped `VanguardMgr` for something that + /// requires bootstrapping to have completed. + #[error("Cannot {action} with unbootstrapped vanguard manager")] + BootstrapRequired { + /// What we were trying to do that required bootstrapping. + action: &'static str, + }, + /// Could not find a suitable relay to use for the specifier layer. #[error("No suitable relays")] NoSuitableRelay(Layer), @@ -35,6 +43,7 @@ pub enum VanguardMgrError { impl HasKind for VanguardMgrError { fn kind(&self) -> ErrorKind { match self { + VanguardMgrError::BootstrapRequired { .. } => ErrorKind::BootstrapRequired, // TODO HS-VANGUARDS: this is not right VanguardMgrError::NoSuitableRelay(_) => ErrorKind::Other, VanguardMgrError::NetDir(e) => e.kind(), |