aboutsummaryrefslogtreecommitdiff
path: root/src/libs/intertrait/cast/error.rs
blob: d253fc598cbc2c814e565a08fd26f0c7ddd4d8d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use crate::libs::intertrait::{CasterError, GetCasterError};

#[derive(thiserror::Error, Debug)]
pub enum CastError
{
    #[error("Failed to get caster")]
    GetCasterFailed(#[from] GetCasterError),

    #[error("Failed to cast from {from} to {to}")]
    CastFailed
    {
        #[source]
        source: CasterError,
        from: &'static str,
        to: &'static str,
    },

    #[error("'{0}' can't be cast to an Arc")]
    NotArcCastable(&'static str),
}