mirror of
https://github.com/TECHNOFAB11/pay-respects.git
synced 2025-12-11 22:10:09 +01:00
chore: always show raw body on parse failure
This commit is contained in:
parent
c1e26296e8
commit
01c541e2bb
1 changed files with 3 additions and 2 deletions
|
|
@ -153,7 +153,7 @@ The command `{last_command}` returns the following error message: `{error_msg}`.
|
||||||
if let Ok(json) = json {
|
if let Ok(json) = json {
|
||||||
json
|
json
|
||||||
} else {
|
} else {
|
||||||
eprintln!("Failed to parse JSON response: {}", res);
|
eprintln!("AI module: Failed to parse JSON response: {}", res);
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -164,12 +164,13 @@ The command `{last_command}` returns the following error message: `{error_msg}`.
|
||||||
let str = {
|
let str = {
|
||||||
let str = content.as_str();
|
let str = content.as_str();
|
||||||
str?;
|
str?;
|
||||||
str.expect("Failed to get content from response")
|
str.expect("AI module: Failed to get content from response")
|
||||||
.trim_start_matches("```")
|
.trim_start_matches("```")
|
||||||
.trim_end_matches("```")
|
.trim_end_matches("```")
|
||||||
};
|
};
|
||||||
let json = serde_json::from_str(str);
|
let json = serde_json::from_str(str);
|
||||||
if json.is_err() {
|
if json.is_err() {
|
||||||
|
eprintln!("AI module: Failed to parse JSON content: {}", str);
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
json.unwrap()
|
json.unwrap()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue