scsys_crypto/error.rs
1/*
2 Appellation: error <module>
3 Contrib: @FL03
4*/
5//! this module provides error handling utilities for the `scsys-crypto` crate
6
7/// a type alias for a [`Result`](core::result::Result) with the error type fixed to [`Error`]
8pub type Result<T = ()> = core::result::Result<T, Error>;
9
10/// a custom error type for the `scsys-crypto` crate
11#[derive(Debug, thiserror::Error)]
12pub enum Error {
13 #[error(transparent)]
14 CoreError(scsys_core::error::Error),
15 #[error("An unhashable object was provided")]
16 Unhashable,
17}
18
19impl From<Error> for scsys_core::error::Error {
20 fn from(err: Error) -> Self {
21 match err {
22 Error::CoreError(e) => e,
23 e => scsys_core::error::Error::box_error(e),
24 }
25 }
26}