//! Error types for ONNX code generation. use thiserror::Error; /// Result type for ONNX code generation operations. pub type Result = std::result::Result; /// Errors that can occur during ONNX model import and code generation. #[derive(Error, Debug)] pub enum Error { /// Failed to read the ONNX file. #[error("Failed to read ONNX file: {0}")] FileRead(#[from] std::io::Error), /// Failed to parse the ONNX protobuf. #[error("Failed to parse ONNX protobuf: {0}")] ProtobufParse(#[from] prost::DecodeError), /// Unsupported ONNX operator. #[error("Unsupported ONNX operator: {0}")] UnsupportedOperator(String), /// Invalid ONNX model structure. #[error("Invalid ONNX model: {0}")] InvalidModel(String), /// Missing required attribute. #[error("Missing required attribute '{0}' for operator '{1}'")] MissingAttribute(String, String), /// Invalid attribute value. #[error("Invalid attribute value for '{0}': {1}")] InvalidAttribute(String, String), /// Shape inference error. #[error("Shape inference error: {0}")] ShapeInference(String), /// Code generation error. #[error("Code generation error: {0}")] CodeGen(String), /// Unsupported data type. #[error("Unsupported data type: {0}")] UnsupportedDataType(i32), }