You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ws_msg.data.B.parse::<f64>().map_err(|_| SimpleError::new("Failed to parse ws_msg.data.B"));
Besides, I recommended replacing SimpleError to anyhow. It allows us wrapping all the error with a generic Error:
fnparse() -> anyhow::Result<T>{// Even simpler than `.unwrap()`. Besides, the `parse()` is recoverable now!
ws_msg.data.B.parse::<f64>()?;// If you need context:
ws_msg.data.B.parse::<f64>().context("Failed to parse ws_msg.data.B")?;}
TBDs (To Be Discussed)
Use anyhow or remain SimpleError? I prefer former.
Migrate it with less breaking changes (or just make it without writing too many “runtime” to unwrap)
The text was updated successfully, but these errors were encountered:
Abstract
crypto-crawler
panics when the data format is invalid, which may have better recoverable way to indicate instead of just aborting the whole tasks.Solution
Replace all of them to
Result<T, SimpleError>
:Besides, I recommended replacing
SimpleError
toanyhow
. It allows us wrapping all the error with a generic Error:TBDs (To Be Discussed)
anyhow
or remainSimpleError
? I prefer former.The text was updated successfully, but these errors were encountered: