tor-dirmgr: impl AsRef<dyn Error> for Error

This allows use with tor_error::Report.
This commit is contained in:
Ian Jackson 2022-11-02 18:59:51 +00:00
parent f3957a50b6
commit 9424b0970d
1 changed files with 7 additions and 0 deletions

View File

@ -1,5 +1,6 @@
//! Declare an error type for the tor-dirmgr crate.
use std::error::Error as StdError;
use std::sync::Arc;
use crate::DocSource;
@ -155,6 +156,12 @@ impl From<tor_rtcompat::scheduler::SleepError> for Error {
}
}
impl AsRef<dyn StdError + 'static> for Error {
fn as_ref(&self) -> &(dyn StdError + 'static) {
self
}
}
/// The effect that a given error has on our bootstrapping process
#[derive(Copy, Clone, Debug)]
pub(crate) enum BootstrapAction {