With that, whenever the Error type is returned and we say that the return type of a function when it errors is MyOwnError, the from function will be called.
Good luck!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Awesome! You'd be amazed by the power of traits. Be careful about noisy match statements in error handling though. Try using impl for error types!
For example,
impl From<Error> for MyOwnError {
fn from(err: Error) -> Self {
MyOwnError { message: "oh no! }
}
}
With that, whenever the Error type is returned and we say that the return type of a function when it errors is MyOwnError, the from function will be called.
Good luck!