Routes engine errors to the matching host exception kind. */
(e: ReError)
| 72 | |
| 73 | /* Routes engine errors to the matching host exception kind. */ |
| 74 | fn to_error(e: ReError) -> Error { |
| 75 | match e { |
| 76 | ReError::Syntax(m) => Error::Value(m), // bad pattern is a ValueError |
| 77 | ReError::TooComplex(m) => Error::Runtime(m), // degradation is a RuntimeError |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | fn rx<T>(r: core::result::Result<T, ReError>) -> Result<T> { |
| 82 | r.map_err(to_error) |