Skip to main content

gin_tonic_core/
error.rs

1use std::{array::TryFromSliceError, str::Utf8Error};
2
3use varint_simd::VarIntDecodeError;
4
5#[derive(Debug, thiserror::Error)]
6pub enum ProtoError {
7    #[error(transparent)]
8    VarInt(#[from] VarIntDecodeError),
9    #[error(transparent)]
10    Utf8(#[from] Utf8Error),
11    #[error(transparent)]
12    ArrayFromSlice(#[from] TryFromSliceError),
13    #[error("Field number {0} is missing")]
14    MissingField(u32),
15    #[error("No OneOf variants found, expected one of: {0:?}")]
16    MissingOneOf(&'static [u32]),
17    #[error("{0} is not a known enum variant")]
18    UnknownEnumVariant(i32),
19    #[error("{0}")]
20    Custom(String),
21}