use error_forge::ForgeError;
use iqdb_types::IqdbError;
fn main() {
let errors = [
IqdbError::DimensionMismatch {
expected: 768,
found: 384,
},
IqdbError::InvalidVector,
IqdbError::InvalidConfig {
reason: "dim must be greater than zero",
},
IqdbError::NotFound,
IqdbError::Duplicate,
IqdbError::InvalidMetric,
IqdbError::InvalidFilter,
IqdbError::ResourceLimitExceeded {
kind: "metadata_keys",
max: 64,
found: 91,
},
];
for err in errors {
println!("[{}] {} — {}", err.kind(), err.caption(), err);
}
let err = IqdbError::DimensionMismatch {
expected: 3,
found: 2,
};
match err {
IqdbError::DimensionMismatch { expected, found } => {
println!("recover: re-embed the query at {expected} dims (got {found})");
}
other => println!("unhandled: {other}"),
}
}