app_store: handling error responses

This commit is contained in:
bitful-pannul 2024-09-11 00:20:09 +03:00
parent f704eb9521
commit 20af8cd17e
3 changed files with 15 additions and 3 deletions

View File

@ -55,6 +55,7 @@ interface downloads {
http-client-error,
blob-not-found,
vfs-error,
handling-error(string),
}
record download-complete-request {
@ -192,7 +193,6 @@ interface main {
local(local-response),
chain-error(chain-error),
download-error(download-error),
send-error(string),
handling-error(string),
}

View File

@ -78,7 +78,12 @@ fn init(our: Address) {
}
Ok(message) => {
if let Err(e) = handle_message(&our, &mut state, &mut http_server, &message) {
print_to_terminal(1, &format!("main: error handling message: {e:?}"));
let error_message = format!("error handling message: {e:?}");
print_to_terminal(1, &error_message);
Response::new()
.body(AppStoreResponse::HandlingError(error_message))
.send()
.unwrap();
}
}
}

View File

@ -94,7 +94,14 @@ fn init(our: Address) {
&mut tmp,
&mut auto_updates,
) {
print_to_terminal(1, &format!("downloads: error handling message: {:?}", e));
let error_message = format!("error handling message: {e:?}");
print_to_terminal(1, &error_message);
Response::new()
.body(DownloadResponses::Err(DownloadError::HandlingError(
error_message,
)))
.send()
.unwrap();
}
}
}