lambdaworks_math/
errors.rs

1#[derive(Debug, PartialEq, Eq)]
2pub enum ByteConversionError {
3    FromBEBytesError,
4    FromLEBytesError,
5    InvalidValue,
6    PointNotInSubgroup,
7    ValueNotCompressed,
8    ValueNotReduced,
9}
10
11#[derive(Debug, PartialEq, Eq)]
12pub enum CreationError {
13    InvalidHexString,
14    InvalidDecString,
15    HexStringIsTooBig,
16    RepresentativeOutOfRange,
17    EmptyString,
18}
19
20#[derive(Debug, PartialEq, Eq)]
21pub enum DeserializationError {
22    InvalidAmountOfBytes,
23    FieldFromBytesError,
24    PointerSizeError,
25    InvalidValue,
26}
27
28#[derive(Debug, PartialEq, Eq)]
29pub enum PairingError {
30    PointNotInSubgroup,
31    DivisionByZero,
32}
33
34impl From<ByteConversionError> for DeserializationError {
35    fn from(error: ByteConversionError) -> Self {
36        match error {
37            ByteConversionError::FromBEBytesError => DeserializationError::FieldFromBytesError,
38            ByteConversionError::FromLEBytesError => DeserializationError::FieldFromBytesError,
39            _ => DeserializationError::InvalidValue,
40        }
41    }
42}