Macro tor_error::into_bad_api_usage
source · [−]macro_rules! into_bad_api_usage {
{ $( $arg:tt )* } => { ... };
}
Expand description
Helper for converting an error into an bad API usage error
Returns a closure implementing FnOnce(E) -> InternalError
.
The source error E
must be std::error::Error + Send + Sync + 'static
.
Examples
use tor_error::into_bad_api_usage;
let host = std::str::from_utf8(host).map_err(into_bad_api_usage!("hostname is bad UTF-8: {:?}", host))?;