Skip to content

bioamla.exceptions

bioamla.exceptions

The library follows idiomatic Python error handling: functions return plain data and raise exceptions on failure. Every exception derives from :class:BioamlaError, so applications (and the CLI) can catch the whole family with a single except.

The CLI layer catches :class:BioamlaError centrally and prints a friendly message (see bioamla.cli.errors); library consumers can catch the base class or any of the more specific subclasses below.

BioamlaError

Bases: Exception

Base class for all bioamla errors.

InvalidInputError

Bases: BioamlaError

Caller passed bad, contradictory, or out-of-range arguments.

NotFoundError

Bases: BioamlaError

A required input path or resource does not exist.

AudioLoadError

Bases: BioamlaError

Failed to load or decode an audio file.

AudioSaveError

Bases: BioamlaError

Failed to encode or write an audio file.

DependencyError

Bases: BioamlaError

A required dependency is unavailable at runtime.

All Python dependencies ship in the base install, so this is reserved for genuine environment problems (e.g. a missing system library or a broken install).

ModelError

Bases: BioamlaError

Model load, inference, or embedding-extraction failure.

TrainingError

Bases: ModelError

Model training failure: bad dataset/params, or an empty training set.

CatalogError

Bases: BioamlaError

External catalog / API failure (xeno-canto, iNaturalist, eBird, Macaulay, HF).

SpeciesError

Bases: CatalogError

Species lookup, name-conversion, or taxonomy-export failure.

ConfigError

Bases: BioamlaError

Configuration file parse or validation failure.

ProcessingError

Bases: BioamlaError

A pipeline/processing failure that doesn't fit a more specific class.

ClusteringError

Bases: BioamlaError

A clustering, dimensionality-reduction, or novelty-detection failure.

DetectionError

Bases: BioamlaError

An acoustic detection (energy, RIBBIT, CWT peaks, patterns) failure.

InvalidDetectionParams

Bases: InvalidInputError

Caller passed invalid parameters to a detector (e.g. high_freq <= low_freq).

DatasetError

Bases: BioamlaError

Base class for dataset-domain failures (merge, augment, license, stats).

MergeError

Bases: DatasetError

Merging audio datasets failed.

AugmentationError

Bases: DatasetError

Audio augmentation (noise/stretch/pitch/gain) failed.

LicenseGenerationError

Bases: DatasetError

Generating a license/attribution file from dataset metadata failed.

AnnotationError

Bases: BioamlaError

An annotation operation (import/export/extraction/measurement) failed.