use thiserror::Error;
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum ValueWireLimitKind {
InputBytes,
Depth,
Nodes,
CollectionItems,
MapEntries,
StringBytes,
NumericBytes,
}
#[non_exhaustive]
#[derive(Debug, Error)]
pub enum ValueWireDecodeError {
#[error(
"wire input contains {input_bytes} bytes, exceeding the {max_input_bytes}-byte limit"
)]
InputTooLarge {
input_bytes: usize,
max_input_bytes: usize,
},
#[error("wire input {kind:?} value {value} exceeds the limit of {maximum}")]
LimitExceeded {
kind: ValueWireLimitKind,
value: usize,
maximum: usize,
},
#[error("failed to decode V1 JSON wire input: {0}")]
InvalidJson(#[from] serde_json::Error),
}