aboutsummaryrefslogtreecommitdiff
path: root/src/libs/intertrait/cast/error.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-11-06 14:06:22 +0100
committerHampusM <hampus@hampusmat.com>2022-11-06 14:06:22 +0100
commit3c993aa73c93f0fe335ced78d9709b39cdbd1935 (patch)
tree5b8d1d3bf743fe2383687d172caaee08df69a08b /src/libs/intertrait/cast/error.rs
parente665c2a3ca9b15f406c8e12e4a7ab372fcad4d36 (diff)
refactor: improve cast error handling
Diffstat (limited to 'src/libs/intertrait/cast/error.rs')
-rw-r--r--src/libs/intertrait/cast/error.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libs/intertrait/cast/error.rs b/src/libs/intertrait/cast/error.rs
index a834c05..e6d86a5 100644
--- a/src/libs/intertrait/cast/error.rs
+++ b/src/libs/intertrait/cast/error.rs
@@ -1,9 +1,16 @@
+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 trait {from} to trait {to}")]
CastFailed
{
+ #[source]
+ source: CasterError,
from: &'static str,
to: &'static str,
},