Print the error
(something: &EcResult<T>)
| 2014 | |
| 2015 | /// Print the error |
| 2016 | pub fn print_err_ref<T>(something: &EcResult<T>) { |
| 2017 | match something { |
| 2018 | Ok(_) => {} |
| 2019 | // TODO: Some errors we can handle and retry, like Busy, Timeout, InProgress, ... |
| 2020 | Err(EcError::Response(status)) => { |
| 2021 | error!("EC Response Code: {:?}", status); |
| 2022 | } |
| 2023 | Err(EcError::UnknownResponseCode(code)) => { |
| 2024 | error!("Invalid response code from EC command: {:X}", code); |
| 2025 | } |
| 2026 | Err(EcError::DeviceError(str)) => { |
| 2027 | error!("Failed to communicate with EC. Reason: {:?}", str); |
| 2028 | } |
| 2029 | } |
| 2030 | } |
| 2031 | |
| 2032 | /// Print the error and turn Result into Option |
| 2033 | /// |
no outgoing calls
no test coverage detected