Version: dev

error

Stable error · Errors

Tier: stable · Kind: error · Topic: Errors

PythonJuliaRust
EarthSciIOErrornot exportedError

Python

class EarthSciIOError(Exception)

Base class for every EarthSciIO error.

Source

Julia

Julia does not export this error.

Rust

pub enum Error {
    CacheMiss { url: String, key: String },
    Integrity { key: String, detail: String },
    UnknownScheme { scheme: String, url: String },
    UnknownStore { name: String },
    BadUrl { url: String, detail: String },
    Transport { url: String, detail: String },
    NotFound { url: String, detail: String },
    AllMirrorsFailed { url: String, detail: String, not_found: bool },
    MissingAuth { realm: String },
    Io { path: Option<PathBuf>, source: Error },
    Manifest { detail: String },
    UnknownFormat { name: String },
    BadConfig { var: String, detail: String },
    Format { format: String, detail: String },
}

impl Error { pub fn io(path: Option<PathBuf>, source: Error) -> Self }

impl Error { pub fn is_cache_miss(&self) -> bool }

impl Error { pub fn is_not_found(&self) -> bool }

Errors raised by the cache, transports, and stores.

CacheMiss is load-bearing for the offline contract: it carries both the resolved URL and its cache key so a failure names exactly which blob the corpus/cache is missing (see spec/offline-mode.md §2).

Source · Rust docs

Example (offline)

let offline = Cache::builder()
    .data_dir(cache_root.path())
    .offline(true)
    .build()?;
assert!(offline.is_offline());
assert_eq!(offline.fetch(&FetchRequest::new(&url))?.path, blob.path); // served from disk only

// An offline miss is an error, never a network request.
let miss = offline
    .fetch(&FetchRequest::new("file:///not/cached.csv"))
    .unwrap_err();
assert!(miss.is_cache_miss());

From docs/api/examples/rust/fetch.rs