Better handling of errors, not good, but better.

This commit is contained in:
2019-01-17 10:46:46 +01:00
parent b214f9b621
commit a3e515c3a7
11 changed files with 162 additions and 25 deletions

View File

@@ -15,7 +15,7 @@ struct Info {
pub struct KonsumentInfo;
impl Probe for KonsumentInfo {
fn search(&mut self, ctx: &mut Context, number: &str) {
fn search(&mut self, ctx: &mut Context, number: &str) -> Result<(), ()> {
let body = if let Some(cache) = ctx.cache_get("konsument_info", &number) {
String::from_utf8(cache.data).unwrap()
} else {
@@ -38,5 +38,7 @@ impl Probe for KonsumentInfo {
} else {
println!(" Failed to find any data");
}
Ok(())
}
}