bridge config: Feature-gate the error variants
This leaves this enum empty of actual errors, when bridge-client is disabled. We're going to add the not supported variant in a moment.
This commit is contained in:
parent
5800b1cdc9
commit
c4a3b0b5c4
|
@ -10,10 +10,12 @@ use thiserror::Error;
|
|||
#[non_exhaustive]
|
||||
pub enum BridgeParseError {
|
||||
/// Bridge line was empty
|
||||
#[cfg(feature = "bridge-client")]
|
||||
#[error("Bridge line was empty")]
|
||||
Empty,
|
||||
|
||||
/// Expected PT name or host:port, looked a bit like a PT name, but didn't parse
|
||||
#[cfg(feature = "bridge-client")]
|
||||
#[error(
|
||||
"Cannot parse {word:?} as PT name ({pt_error}), nor as direct bridge IpAddress:ORPort"
|
||||
)]
|
||||
|
@ -25,6 +27,7 @@ pub enum BridgeParseError {
|
|||
},
|
||||
|
||||
/// Expected PT name or host:port, looked a bit like a host:port, but didn't parse
|
||||
#[cfg(feature = "bridge-client")]
|
||||
#[error(
|
||||
"Cannot parse {word:?} as direct bridge IpAddress:ORPort ({addr_error}), nor as PT name"
|
||||
)]
|
||||
|
@ -47,6 +50,7 @@ pub enum BridgeParseError {
|
|||
},
|
||||
|
||||
/// Cannot parse value as identity key, or PT key=value
|
||||
#[cfg(feature = "bridge-client")]
|
||||
#[error("Cannot parse {word:?} as identity key ({id_error}), or PT key=value")]
|
||||
InvalidIdentityOrParameter {
|
||||
/// The offending word
|
||||
|
@ -75,6 +79,7 @@ pub enum BridgeParseError {
|
|||
},
|
||||
|
||||
/// More than one identity of the same type specified
|
||||
#[cfg(feature = "bridge-client")]
|
||||
#[error("More than one identity of the same type specified, at {word:?}")]
|
||||
MultipleIdentitiesOfSameType {
|
||||
/// The offending word
|
||||
|
@ -82,6 +87,7 @@ pub enum BridgeParseError {
|
|||
},
|
||||
|
||||
/// Identity specified of unsupported type
|
||||
#[cfg(feature = "bridge-client")]
|
||||
#[error("Identity specified but not of supported type, at {word:?}")]
|
||||
UnsupportedIdentityType {
|
||||
/// The offending word
|
||||
|
@ -89,15 +95,18 @@ pub enum BridgeParseError {
|
|||
},
|
||||
|
||||
/// Parameters may only be specified with a pluggable transport
|
||||
#[cfg(feature = "bridge-client")]
|
||||
#[error("Parameters supplied but not valid without a pluggable transport")]
|
||||
DirectParametersNotAllowed,
|
||||
|
||||
/// Every bridge must have an RSA identity
|
||||
#[cfg(feature = "bridge-client")]
|
||||
#[error("Bridge line lacks specification of RSA identity key")]
|
||||
NoRsaIdentity,
|
||||
|
||||
/// Pluggable transport support disabled in cargo features
|
||||
// We deliberately make this one *not* configured out if PT support is enabled
|
||||
#[cfg(feature = "bridge-client")]
|
||||
#[error("Pluggable transport requested ({word:?} is not an IpAddress:ORPort), but support disabled in cargo features")]
|
||||
PluggableTransportsNotSupported {
|
||||
/// The offending word
|
||||
|
|
Loading…
Reference in New Issue