Extract some value from the query result, unless there was an error.
(res: AbciQuery, f: F)
| 201 | |
| 202 | /// Extract some value from the query result, unless there was an error. |
| 203 | fn extract<T, F>(res: AbciQuery, f: F) -> anyhow::Result<T> |
| 204 | where |
| 205 | F: FnOnce(AbciQuery) -> anyhow::Result<T>, |
| 206 | { |
| 207 | if res.code.is_err() { |
| 208 | Err(anyhow!( |
| 209 | "query returned non-zero exit code: {}", |
| 210 | res.code.value() |
| 211 | )) |
| 212 | } else { |
| 213 | f(res) |
| 214 | } |
| 215 | } |
| 216 | |
| 217 | fn extract_actor_state(res: AbciQuery) -> anyhow::Result<Option<(ActorID, ActorState)>> { |
| 218 | extract_opt(res, |res| { |
no outgoing calls
no test coverage detected