diff --git a/crates/tor-error/src/lib.rs b/crates/tor-error/src/lib.rs index d525cd49f..1941c8b30 100644 --- a/crates/tor-error/src/lib.rs +++ b/crates/tor-error/src/lib.rs @@ -156,16 +156,33 @@ pub enum ErrorKind { /// A requested operation was not implemented by Arti. /// - /// This kind of error can happen when calling an API that isn't available - /// at runtime, or when requesting a piece of protocol functionality that is - /// not implemented. + /// This kind of error can happen when requesting a piece of protocol + /// functionality that has not (yet) been implemented in the Arti project. /// /// If it happens as a result of a user activity, it's fine to ignore, log, /// or report the error. If it happens as a result of direct API usage, it - /// may indicate that you're using something that isn't implemented yet, or - /// hasn't been turned on for your build environment. - #[display(fmt = "operation not supported")] - NoSupport, + /// may indicate that you're using something that isn't implemented yet. + /// + /// This kind can relate both to operations which we plan to implement, and + /// to operations which we do not. It does not relate to faciities which + /// are disabled (e.g. at build time) or harmful. + /// + /// It can refer to facilities which were once implemented in Tor or Arti + /// but for which support has been removed. + #[display(fmt = "operation not implemented")] + NotImplemented, + + /// A feature was requested which has been disabled in this build of Arti. + ///! + /// This kind of error happens when the running Arti was built wityout the + /// appropriate feature (usually, cargo feature) enabled. + ///! + /// This might indicate that the overall running system has been + /// mis-configured at build-time. Alternatively, it can occur if the + /// running system is deliberately stripped down, in which case it might be + /// reasonable to simply report this error to a user. + #[display(fmt = "operation not supported because Arti feature disabled")] + FeatureDisabled, /// Someone or something violated a network protocol. /// diff --git a/crates/tor-socksproto/src/err.rs b/crates/tor-socksproto/src/err.rs index 0733cf50e..c5d9ad252 100644 --- a/crates/tor-socksproto/src/err.rs +++ b/crates/tor-socksproto/src/err.rs @@ -31,8 +31,8 @@ pub enum Error { /// The SOCKS client tried to use a SOCKS feature that we don't /// support at all. - #[error("SOCKS feature not supported")] - NoSupport, + #[error("SOCKS feature not implemented")] + NotImplemented, /// Tried to progress the SOCKS handshake when it was already /// finished. This is a programming error. @@ -59,7 +59,7 @@ impl HasKind for Error { } E::Syntax | E::Decode(_) | E::BadProtocol(_) => EK::ProtocolViolation, E::Invalid(_) => EK::BadArgument, - E::NoSupport => EK::NoSupport, + E::NotImplemented => EK::NotImplemented, E::AlreadyFinished(_) => EK::Internal, E::Internal(_) => EK::Internal, } diff --git a/crates/tor-socksproto/src/handshake.rs b/crates/tor-socksproto/src/handshake.rs index 742c25e86..f16bcee9b 100644 --- a/crates/tor-socksproto/src/handshake.rs +++ b/crates/tor-socksproto/src/handshake.rs @@ -180,7 +180,7 @@ impl SocksHandshake { (State::Socks5Wait, [5, NO_AUTHENTICATION]) } else { // In theory we should reply with "NO ACCEPTABLE METHODS". - return Err(Error::NoSupport); + return Err(Error::NotImplemented); }; self.state = next; @@ -197,7 +197,7 @@ impl SocksHandshake { let ver = r.take_u8()?; if ver != 1 { - return Err(Error::NoSupport); + return Err(Error::NotImplemented); } let ulen = r.take_u8()?; diff --git a/crates/tor-socksproto/src/msg.rs b/crates/tor-socksproto/src/msg.rs index be67008d3..f60a9823f 100644 --- a/crates/tor-socksproto/src/msg.rs +++ b/crates/tor-socksproto/src/msg.rs @@ -200,7 +200,7 @@ impl SocksRequest { auth: SocksAuth, ) -> Result { if !cmd.recognized() { - return Err(Error::NoSupport); + return Err(Error::NotImplemented); } if port == 0 && cmd.requires_port() { return Err(Error::Syntax);