Skip to main content

urna_runtime/
error.rs

1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum RuntimeError {
5    #[error(transparent)]
6    Format(#[from] urna_format::UrnaError),
7    #[error("{0}")]
8    Io(#[from] std::io::Error),
9    #[error("dimension mismatch: expected {expected}, got {got}")]
10    DimensionMismatch { expected: usize, got: usize },
11    #[error("invalid k: {0}")]
12    InvalidK(i32),
13    #[error("empty query")]
14    EmptyQuery,
15    #[error("zero-norm query")]
16    ZeroNormQuery,
17    #[error("NaN or Inf in query")]
18    InvalidQueryValue,
19    #[error("embedding space not found: {0}")]
20    SpaceNotFound(String),
21    #[error(
22        "blob {index} is not inlined in this file: open the media sidecar \
23         named by its blob_refs uri, or rebuild with [output] embed_media"
24    )]
25    BlobNotInlined { index: usize },
26    #[error(
27        "model_hash mismatch in space {space}: the query was embedded with {expected}, \
28         but the space vectors were embedded with {actual}"
29    )]
30    SpaceModelMismatch {
31        space: String,
32        expected: String,
33        actual: String,
34    },
35}