Skip to content

Commit

Permalink
Merge pull request #15 from axodotdev/better_error_receipt_load_failure
Browse files Browse the repository at this point in the history
feat: return better error when receipt load fails
mistydemeo authored Feb 16, 2024
2 parents fb12397 + 6746189 commit 84bbb6b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -239,6 +239,10 @@ pub enum AxoupdateError {
#[diagnostic(help("This probably isn't your fault; please open an issue!"))]
ConfigFetchFailed { app_name: String },

#[error("Unable to read installation information for app {app_name}.")]
#[diagnostic(help("This probably isn't your fault; please open an issue!"))]
ReceiptLoadFailed { app_name: String },

#[error("Unable to determine the name of the app to update")]
#[diagnostic(help("This probably isn't your fault; please open an issue!"))]
NoAppName {},
@@ -472,5 +476,7 @@ fn load_receipt_for(app_name: &String) -> AxoupdateResult<InstallReceipt> {

let install_receipt_path = receipt_prefix.join(format!("{app_name}-receipt.json"));

load_receipt_from_path(&install_receipt_path)
load_receipt_from_path(&install_receipt_path).map_err(|_| AxoupdateError::ReceiptLoadFailed {
app_name: app_name.to_owned(),
})
}

0 comments on commit 84bbb6b

Please sign in to comment.