nss/
error.rs

1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5#[derive(Debug, thiserror::Error)]
6pub enum ErrorKind {
7    #[error("NSS error: {0} {1}")]
8    NSSError(i32, String),
9    #[error("SSL error: {0} {1}")]
10    SSLError(i32, String),
11    #[error("PKIX error: {0} {1}")]
12    PKIXError(i32, String),
13    #[error("Input or format error: {0}")]
14    InputError(String),
15    #[error("Internal crypto error")]
16    InternalError,
17    #[error("invalid key length")]
18    InvalidKeyLength,
19    #[error("Interior nul byte was found")]
20    NulError,
21    #[error("Conversion error: {0}")]
22    ConversionError(#[from] std::num::TryFromIntError),
23    #[error("Base64 decode error: {0}")]
24    Base64Decode(#[from] base64::DecodeError),
25    #[error("Certificate issuer does not match")]
26    CertificateIssuerError,
27    #[error("Certificate subject does not match")]
28    CertificateSubjectError,
29    #[error("Certificate not yet valid or expired")]
30    CertificateValidityError,
31}
32
33error_support::define_error! {
34    ErrorKind {
35        (Base64Decode, base64::DecodeError),
36        (ConversionError, std::num::TryFromIntError),
37    }
38}