1use anyhow::Error;
18use thiserror::Error;
19
20use crate::ttype::TType;
21use crate::ApplicationException;
22
23#[derive(Debug, Error)]
24#[allow(dead_code)]
25pub enum ProtocolError {
26 #[error("end of file reached")]
27 EOF,
28 #[error("bad thrift version specified")]
29 BadVersion,
30 #[error("missing protocol version")]
31 ProtocolVersionMissing,
32 #[error("protocol skip depth exceeded")]
33 SkipDepthExceeded,
34 #[error("streams unsupported")]
35 StreamUnsupported,
36 #[error("STOP outside of struct in skip")]
37 UnexpectedStopInSkip,
38 #[error("Invalid type in skip {0:?}")]
39 InvalidTypeInSkip(TType),
40 #[error("Unknown or invalid protocol ID {0}")]
41 InvalidProtocolID(i16),
42 #[error("Unknown or invalid TMessage type {0}")]
43 InvalidMessageType(u32),
44 #[error("Unknown or invalid type tag")]
45 InvalidTypeTag,
46 #[error("Unknown or invalid data length")]
47 InvalidDataLength,
48 #[error("Invalid value for type")]
49 InvalidValue,
50 #[error("Unexpected trailing data after the end of a value")]
51 TrailingData,
52 #[error("Unwanted extra union {0} field ty {1:?} id {2}")]
53 UnwantedExtraUnionField(String, TType, i32),
54}
55
56#[derive(Debug, Error)]
58pub enum NonthrowingFunctionError {
59 #[error(transparent)]
60 ApplicationException(#[from] ApplicationException),
61 #[error(transparent)]
62 ThriftError(#[from] Error),
63}