Open CowBoy4mH3LL opened 2 months ago
Your custom error type must be serializable and it must implement From<CallError>
.
For example:
// Custom error type that can convert from CallError.
#[derive(Debug, serde::Serialize, serde::Deserialize)]
pub enum IncreaseError {
Overflow,
Call(CallError),
}
impl From<CallError> for IncreaseError {
fn from(err: CallError) -> Self {
Self::Call(err)
}
}
Say I have a custom error
SError{message:String}
and I implementFrom<std:io:Error>
on it. Now, from a function, say,fn(&self) -> Result<(),SError>
in anrtc::remote
labelled trait, I get anstd:io:error
as a result of callingawait
on some other async function. Even if I have implemented theFrom
cast fromError
toSError
, it does not seem to be able to cast between the output Result forms. Any idea why?