1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
use super::response;
use crate::cql_to_rust::CqlTypeError;
use crate::frame::value::SerializeValuesError;
use thiserror::Error;
#[derive(Error, Debug)]
pub enum FrameError {
#[error(transparent)]
Parse(#[from] ParseError),
#[error("Frame is compressed, but no compression negotiated for connection.")]
NoCompressionNegotiated,
#[error("L4Z body decompression failed")]
Lz4BodyDecompression,
#[error("Received frame marked as coming from a client")]
FrameFromClient,
#[error("Received a frame from version {0}, but only 4 is supported")]
VersionNotSupported(u8),
#[error("Connection was closed before body was read: missing {0} out of {1}")]
ConnectionClosed(usize, usize),
#[error("Frame decompression failed.")]
FrameDecompression,
#[error("Frame compression failed.")]
FrameCompression,
#[error("std io error encountered while processing")]
StdIoError(#[from] std::io::Error),
#[error("Unrecognized opcode{0}")]
TryFromPrimitiveError(#[from] num_enum::TryFromPrimitiveError<response::ResponseOpcode>),
}
#[derive(Error, Debug)]
pub enum ParseError {
#[error("Could not serialize frame: {0}")]
BadData(String),
#[error(transparent)]
IoError(#[from] std::io::Error),
#[error("type not yet implemented, id: {0}")]
TypeNotImplemented(i16),
#[error(transparent)]
SerializeValuesError(#[from] SerializeValuesError),
#[error(transparent)]
CqlTypeError(#[from] CqlTypeError),
}