#[derive(Debug, thiserror::Error)]
pub enum RequestError {
#[error("Invalid UTF-8: {0}")]
InvalidUtf8(#[from] core::str::Utf8Error),
#[error("Invalid JSON: {0}")]
InvalidJson(#[from] serde_json::Error),
#[error("Id is too large, limit of 80 bytes. Got: {0}")]
IdTooLarge(usize),
#[error("Method is not a valid JSON string.")]
InvalidMethod,
#[error("Method is too large, limit of 80 bytes. Got: {0}")]
MethodTooLarge(usize),
#[error("Invalid batch index. Attempted to access index {idx}, but only {len} requests are present.")]
InvalidBatchIndex { idx: usize, len: usize },
#[error("Request is not a JSON object or array.")]
UnexpectedJsonType,
}