pub enum DescriptorError {
Consensus(ConsensusError),
ServerDescriptor(ServerDescriptorError),
Microdescriptor(MicrodescriptorError),
ExtraInfo(ExtraInfoError),
HiddenService(HiddenServiceDescriptorError),
KeyCertificate(KeyCertificateError),
BandwidthFile(BandwidthFileError),
TorDNSEL(TorDNSELError),
UnsupportedCompression(String),
DecompressionFailed(String),
InvalidUtf8(FromUtf8Error),
}Expand description
Unified error type for all descriptor parsing operations.
This enum wraps all descriptor-specific error types, providing a single error type that can represent failures from any descriptor parser.
§Design
Following the library-rs reference implementation, this uses transparent error forwarding with #[error(transparent)] to preserve the underlying error’s Display implementation and source chain.
§Example
use stem_rs::descriptor::DescriptorError;
fn handle_descriptor_error(err: DescriptorError) {
match err {
DescriptorError::Consensus(e) => {
eprintln!("Consensus error: {}", e);
}
DescriptorError::ServerDescriptor(e) => {
eprintln!("Server descriptor error: {}", e);
}
DescriptorError::UnsupportedCompression(format) => {
eprintln!("Unsupported compression: {}", format);
}
_ => eprintln!("Descriptor error: {}", err),
}
}Variants§
Consensus(ConsensusError)
Error parsing network status consensus document.
ServerDescriptor(ServerDescriptorError)
Error parsing server descriptor.
Microdescriptor(MicrodescriptorError)
Error parsing microdescriptor.
ExtraInfo(ExtraInfoError)
Error parsing extra-info descriptor.
HiddenService(HiddenServiceDescriptorError)
Error parsing hidden service descriptor.
KeyCertificate(KeyCertificateError)
Error parsing directory key certificate.
BandwidthFile(BandwidthFileError)
Error parsing bandwidth measurement file.
TorDNSEL(TorDNSELError)
Error parsing TorDNSEL exit list.
UnsupportedCompression(String)
Compression format is not supported.
DecompressionFailed(String)
Decompression failed.
InvalidUtf8(FromUtf8Error)
Descriptor contains invalid UTF-8.