orbital_data/
projection.rs1use std::fmt;
2
3use crate::DataType;
4
5#[derive(Clone, Debug, PartialEq, Eq)]
7pub enum ProjectionError {
8 UnknownField { field: String },
10 TypeMismatch {
12 field: String,
13 expected: &'static str,
14 got: DataType,
15 },
16 EmptyDataset,
18 LengthMismatch {
20 field: String,
21 expected: usize,
22 got: usize,
23 },
24 UnsupportedBinding { reason: String },
26}
27
28impl fmt::Display for ProjectionError {
29 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
30 match self {
31 Self::UnknownField { field } => write!(f, "unknown field '{field}'"),
32 Self::TypeMismatch {
33 field,
34 expected,
35 got,
36 } => write!(f, "field '{field}' expected {expected}, got {got:?}"),
37 Self::EmptyDataset => write!(f, "dataset has no records"),
38 Self::LengthMismatch {
39 field,
40 expected,
41 got,
42 } => write!(
43 f,
44 "field '{field}' length mismatch: expected {expected}, got {got}"
45 ),
46 Self::UnsupportedBinding { reason } => write!(f, "unsupported binding: {reason}"),
47 }
48 }
49}
50
51impl std::error::Error for ProjectionError {}