Debian Codegraph @

crt/s2n/bindings/rust/standard/s2n-tls-hyper/src/error.rs

raw symbols SCIP
1 // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 // SPDX-License-Identifier: Apache-2.0
3
4 use std::fmt::{Display, Formatter};
5
6 /// Indicates which error occurred.
7 #[derive(Debug)]
8 #[non_exhaustive]
9 pub enum Error {
10 /// Indicates that the scheme in the URI provided to the `HttpsConnector` is invalid.
11 InvalidScheme,
12 /// Indicates that an error occurred in the underlying `HttpConnector`.
13 HttpError(Box<dyn std::error::Error + Send + Sync>),
14 /// Indicates that an error occurred in s2n-tls.
15 TlsError(s2n_tls::error::Error),
16 }
17
18 impl Display for Error {
19 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
20 match self {
21 Error::InvalidScheme => write!(f, "The provided URI contains an invalid scheme."),
22 Error::HttpError(err) => write!(f, "{err}"),
23 Error::TlsError(err) => write!(f, "{err}"),
24 }
25 }
26 }
27
28 impl std::error::Error for Error {}