aws_esdk/deps/aws_cryptography_primitives/types/
error.rs

1// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
2// SPDX-License-Identifier: Apache-2.0
3// Do not modify this file. This file is machine generated, and any changes to it will be overwritten.
4#[derive(::std::clone::Clone, ::std::fmt::Debug, ::std::cmp::PartialEq)]
5pub enum Error {
6    #[allow(missing_docs)]
7    AwsCryptographicPrimitivesError {
8        message: ::std::string::String,
9    },
10    CollectionOfErrors {
11        list: ::std::vec::Vec<Self>,
12        message: ::std::string::String,
13    },
14    ValidationError(ValidationError),
15    Opaque {
16        obj: ::dafny_runtime::Object<::dafny_runtime::DynAny>,
17    },
18    OpaqueWithText {
19        obj: ::dafny_runtime::Object<::dafny_runtime::DynAny>,
20        objMessage: ::std::string::String,
21    },
22}
23
24impl ::std::cmp::Eq for Error {}
25
26impl ::std::fmt::Display for Error {
27    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
28        match self {
29            Self::ValidationError(err) => ::std::fmt::Display::fmt(err, f),
30            _ => ::std::fmt::Debug::fmt(self, f),
31        }
32    }
33}
34
35impl ::std::error::Error for Error {
36    fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
37        match self {
38            Self::ValidationError(err) => Some(err),
39            _ => None,
40        }
41    }
42}
43
44impl Error {
45    pub fn wrap_validation_err<E>(err: E) -> Self
46    where
47        E: ::std::error::Error + Send + Sync + 'static,
48    {
49        Self::ValidationError(ValidationError(::dafny_runtime::Rc::new(err)))
50    }
51}
52
53#[derive(::std::clone::Clone, ::std::fmt::Debug)]
54pub struct ValidationError(::dafny_runtime::Rc<dyn ::std::error::Error + Send + Sync>);
55
56impl ::std::cmp::PartialEq for ValidationError {
57    fn eq(&self, other: &Self) -> bool {
58        ::dafny_runtime::Rc::<(dyn std::error::Error + Send + Sync + 'static)>::ptr_eq(
59            &self.0, &other.0,
60        )
61    }
62}
63
64impl ::std::fmt::Display for ValidationError {
65    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
66        ::std::fmt::Display::fmt(&self.0, f)
67    }
68}
69
70impl ::std::error::Error for ValidationError {
71    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
72        ::std::option::Option::Some(self.0.as_ref())
73    }
74}