diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/content.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/content.rs b/src/content.rs index b72f4a8..7ebc129 100644 --- a/src/content.rs +++ b/src/content.rs | |||
@@ -46,7 +46,7 @@ pub fn get_extract(v: &Value) -> Result<String, reqwest::Error> { | |||
46 | let pageid = &v["query"]["pageids"][0]; | 46 | let pageid = &v["query"]["pageids"][0]; |
47 | let pageid_str = match pageid { | 47 | let pageid_str = match pageid { |
48 | Value::String(id) => id, | 48 | Value::String(id) => id, |
49 | _ => panic!("wut"), | 49 | _ => "-1", |
50 | }; | 50 | }; |
51 | 51 | ||
52 | match &v["query"]["pages"][pageid_str]["extract"] { | 52 | match &v["query"]["pages"][pageid_str]["extract"] { |
@@ -57,7 +57,7 @@ pub fn get_extract(v: &Value) -> Result<String, reqwest::Error> { | |||
57 | Ok(format!("{}", extract)) | 57 | Ok(format!("{}", extract)) |
58 | } | 58 | } |
59 | // ignore non strings | 59 | // ignore non strings |
60 | _ => Ok(format!("This page has been deleted or moved")) | 60 | _ => Ok(format!("This page does not exist anymore")) |
61 | } | 61 | } |
62 | } | 62 | } |
63 | 63 | ||
@@ -100,7 +100,7 @@ pub fn extract_formatter(extract: String) -> StyledString { | |||
100 | pub fn get_search_results(search: &str) -> Result<Vec<String>, reqwest::Error> { | 100 | pub fn get_search_results(search: &str) -> Result<Vec<String>, reqwest::Error> { |
101 | let url = search_url_gen(search); | 101 | let url = search_url_gen(search); |
102 | let mut res = reqwest::get(&url[..])?; | 102 | let mut res = reqwest::get(&url[..])?; |
103 | let v: Value = serde_json::from_str(&res.text().unwrap()) | 103 | let v: Value = serde_json::from_str(&res.text()?) |
104 | .unwrap_or_else( |e| { | 104 | .unwrap_or_else( |e| { |
105 | panic!("Recieved error {:?}", e); | 105 | panic!("Recieved error {:?}", e); |
106 | } ); | 106 | } ); |