aboutsummaryrefslogtreecommitdiff
path: root/src-tauri
diff options
context:
space:
mode:
authorGeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com>2023-05-12 00:36:03 +0200
committerGitHub <noreply@github.com>2023-05-12 00:36:03 +0200
commit5d9a3380c8c1384a53ea2ad007a5cdfc7baabdfd (patch)
treea427ef4027f29cd22d1bb5aea6f2ad32f0ddb35d /src-tauri
parent95fa3d72ace4d92f235ac0da1f5333a50201d441 (diff)
downloadFlightCore-5d9a3380c8c1384a53ea2ad007a5cdfc7baabdfd.tar.gz
FlightCore-5d9a3380c8c1384a53ea2ad007a5cdfc7baabdfd.zip
refactor: Handle error if JSON not well-formatted for release notes (#348)
Handle error if JSON not well-formatted for release notes We usually shouldn't hit this cause GitHub shouldn't server broken JSON and if connection failed we should error out earlier yet this was logged on Sentry.
Diffstat (limited to 'src-tauri')
-rw-r--r--src-tauri/src/github/release_notes.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src-tauri/src/github/release_notes.rs b/src-tauri/src/github/release_notes.rs
index b45442e0..4ff075bd 100644
--- a/src-tauri/src/github/release_notes.rs
+++ b/src-tauri/src/github/release_notes.rs
@@ -96,8 +96,13 @@ pub async fn get_northstar_release_notes() -> Result<Vec<ReleaseInfo>, String> {
let url = "https://api.github.com/repos/R2Northstar/Northstar/releases";
let res = fetch_github_releases_api(url).await?;
- let release_info_vector: Vec<ReleaseInfo> =
- serde_json::from_str(&res).expect("JSON was not well-formatted");
+ let release_info_vector: Vec<ReleaseInfo> = match serde_json::from_str(&res) {
+ Ok(res) => res,
+ Err(err) => {
+ log::warn!("{err}");
+ return Err("Could not fetch release notes. JSON was not well-formatted".to_string());
+ }
+ };
log::info!("Done checking GitHub API");
Ok(release_info_vector)