Skip to content

Commit

Permalink
DROP/FIX ME: workaround flex-error issues.
Browse files Browse the repository at this point in the history
This allows upcasting `&'static str` errors to `tendermint::Error`s.
  • Loading branch information
hdevalence committed Sep 10, 2021
1 parent fcf7c59 commit 5b9748f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tendermint/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,5 +206,21 @@ define_error! {

TrustThresholdTooSmall
|_| { "trust threshold too small (must be >= 1/3)" },

Other
{ msg: &'static str }
| e | { format_args!("error: {}", e.msg) },
}
}

impl From<&'static str> for Error {
fn from(msg: &'static str) -> Error {
Error::other(msg)
}
}

impl From<std::convert::Infallible> for Error {
fn from(_never: std::convert::Infallible) -> Error {
unreachable!("Infallible can never be constructed")
}
}

0 comments on commit 5b9748f

Please sign in to comment.