Refactor JSON parsing error logging
This commit is contained in:
parent
8c04365049
commit
5fe9ce8d7b
@ -459,10 +459,11 @@ pub async fn request(path: String) -> Result<Value, String> {
|
|||||||
// If response is success
|
// If response is success
|
||||||
Ok(response) => {
|
Ok(response) => {
|
||||||
// Parse the response from Reddit as JSON
|
// Parse the response from Reddit as JSON
|
||||||
match from_str(&response.into_string().unwrap_or_default()) {
|
let json_string = &response.into_string().unwrap_or_default();
|
||||||
|
match from_str(json_string) {
|
||||||
Ok(json) => Ok(json),
|
Ok(json) => Ok(json),
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
println!("{} - Failed to parse page JSON data: {}", url, e);
|
println!("{} - Failed to parse page JSON data: {} - {}", url, e, json_string);
|
||||||
Err("Failed to parse page JSON data".to_string())
|
Err("Failed to parse page JSON data".to_string())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user