Commit 4bff33c3 authored by Ian Jackson's avatar Ian Jackson
Browse files

Provide an error variant for external directory providers

parent 952aef1b
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -91,6 +91,17 @@ pub enum Error {
        cause: Arc<SpawnError>,
    },

    /// Other error from an external directory provider
    #[error("external directory provider")]
    ExternalDirProvider {
        /// What happened
        #[source]
        cause: Arc<dyn std::error::Error + Send + Sync + 'static>,

        /// The kind
        kind: ErrorKind,
    },

    /// A programming problem, either in our code or the code calling it.
    #[error("programming problem: {0}")]
    Bug(#[from] tor_error::Bug),
@@ -168,6 +179,7 @@ impl HasKind for Error {
            E::IOError(_) => EK::CacheAccessFailed,
            E::OfflineMode => EK::BadApiUsage,
            E::Spawn { cause, .. } => cause.kind(),
            E::ExternalDirProvider { kind, .. } => *kind,
            E::Bug(e) => e.kind(),
        }
    }