use qubit_common::lang::DataType;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum ValueError {
#[error("No value")]
NoValue,
#[error("Type mismatch: expected {expected}, actual {actual}")]
TypeMismatch {
expected: DataType,
actual: DataType,
},
#[error("Type conversion failed: from {from} to {to}")]
ConversionFailed {
from: DataType,
to: DataType,
},
#[error("Conversion error: {0}")]
ConversionError(String),
#[error("Index out of bounds: index {index}, length {len}")]
IndexOutOfBounds {
index: usize,
len: usize,
},
#[error("JSON serialization error: {0}")]
JsonSerializationError(String),
#[error("JSON deserialization error: {0}")]
JsonDeserializationError(String),
}
pub type ValueResult<T> = Result<T, ValueError>;