Split up ErrorKind::NoSupport
This commit is contained in:
parent
9e3d0bc817
commit
30ebb1358a
|
@ -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.
|
||||
///
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
|
|
|
@ -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()?;
|
||||
|
|
|
@ -200,7 +200,7 @@ impl SocksRequest {
|
|||
auth: SocksAuth,
|
||||
) -> Result<Self> {
|
||||
if !cmd.recognized() {
|
||||
return Err(Error::NoSupport);
|
||||
return Err(Error::NotImplemented);
|
||||
}
|
||||
if port == 0 && cmd.requires_port() {
|
||||
return Err(Error::Syntax);
|
||||
|
|
Loading…
Reference in New Issue