hypha: implement custom image fetcher

This commit is contained in:
Alex Zenla
2024-01-18 10:16:59 -08:00
parent 649a0c303d
commit 0bf3eb27f4
6 changed files with 181 additions and 22 deletions

View File

@ -1,6 +1,8 @@
use backhand::BackhandError;
use oci_spec::OciSpecError;
use std::error::Error;
use std::fmt::{Display, Formatter};
use std::num::ParseIntError;
use std::path::StripPrefixError;
use xenclient::XenClientError;
@ -43,12 +45,6 @@ impl From<XenClientError> for HyphaError {
}
}
impl From<ocipkg::error::Error> for HyphaError {
fn from(value: ocipkg::error::Error) -> Self {
HyphaError::new(value.to_string().as_str())
}
}
impl From<walkdir::Error> for HyphaError {
fn from(value: walkdir::Error) -> Self {
HyphaError::new(value.to_string().as_str())
@ -72,3 +68,33 @@ impl From<serde_json::Error> for HyphaError {
HyphaError::new(value.to_string().as_str())
}
}
impl From<ureq::Error> for HyphaError {
fn from(value: ureq::Error) -> Self {
HyphaError::new(value.to_string().as_str())
}
}
impl From<ParseIntError> for HyphaError {
fn from(value: ParseIntError) -> Self {
HyphaError::new(value.to_string().as_str())
}
}
impl From<OciSpecError> for HyphaError {
fn from(value: OciSpecError) -> Self {
HyphaError::new(value.to_string().as_str())
}
}
impl From<url::ParseError> for HyphaError {
fn from(value: url::ParseError) -> Self {
HyphaError::new(value.to_string().as_str())
}
}
impl From<std::fmt::Error> for HyphaError {
fn from(value: std::fmt::Error) -> Self {
HyphaError::new(value.to_string().as_str())
}
}