diff --git a/rs_lib/src/cache.rs b/rs_lib/src/cache.rs index 2603b4e..4bbfd9a 100644 --- a/rs_lib/src/cache.rs +++ b/rs_lib/src/cache.rs @@ -113,10 +113,12 @@ pub fn url_to_filename(url: &Url) -> std::io::Result { Ok(cache_filename) } -#[derive(Debug, Error)] +#[derive(Debug, Error, JsError)] pub enum CacheReadFileError { + #[class(inherit)] #[error(transparent)] Io(#[from] std::io::Error), + #[class(inherit)] #[error(transparent)] ChecksumIntegrity(Box), } diff --git a/rs_lib/src/file_fetcher/mod.rs b/rs_lib/src/file_fetcher/mod.rs index d85e678..ddc88b3 100644 --- a/rs_lib/src/file_fetcher/mod.rs +++ b/rs_lib/src/file_fetcher/mod.rs @@ -181,7 +181,8 @@ pub struct CacheReadError { pub source: std::io::Error, } -#[derive(Debug, Error)] +#[derive(Debug, Error, JsError)] +#[class(generic)] #[error("Failed reading location header for '{}'{}", .request_url, .maybe_location.as_ref().map(|location| format!(" to '{}'", location)).unwrap_or_default())] pub struct RedirectHeaderParseError { pub request_url: Url, @@ -344,15 +345,18 @@ impl From for FetchNoFollowError { } } -#[derive(Debug, Boxed)] +#[derive(Debug, Boxed, JsError)] struct FetchCachedNoFollowError(pub Box); -#[derive(Debug, Error)] +#[derive(Debug, Error, JsError)] enum FetchCachedNoFollowErrorKind { + #[class(inherit)] #[error(transparent)] ChecksumIntegrity(ChecksumIntegrityError), + #[class(inherit)] #[error(transparent)] CacheRead(#[from] CacheReadError), + #[class(inherit)] #[error(transparent)] RedirectResolution(#[from] RedirectResolutionError), }