I've been experimenting with some error handling improvements.
One of them:
pub trait TerminalExt<T, E> {
fn terminal(self) -> Result<T, HandlerError>;
fn terminal_with_code(self, code: u16) -> Result<T, HandlerError>;
}
impl<T, E> TerminalExt<T, E> for Result<T, E>
where
E: std::fmt::Display + std::fmt::Debug + Send + Sync + 'static,
{
fn terminal(self) -> Result<T, HandlerError> {
self.map_err(|err| TerminalError::new(err.to_string()).into())
}
fn terminal_with_code(self, code: u16) -> Result<T, HandlerError> {
self.map_err(|err| TerminalError::new_with_code(code, err.to_string()).into())
}
}
I can open a PR if this sound good to you to be included in the SDK.
I've been experimenting with some error handling improvements.
One of them:
I can open a PR if this sound good to you to be included in the SDK.