v0.1.1: language picker on welcome screen, friendly errors for unpublished package / unreachable server, backlog notes

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
ДмитрийandClaude Sonnet 5.5 committed 2026-09-30 12:27:21 +05:00
1 parent 68050882b8
commit f620f87432
15 files changed
+102 -22

No files matched your search

+18
View File
@@ -20,6 +20,10 @@ pub enum Error {
UnknownInstallation(String),
#[error("{0}")]
Invalid(String),
#[error("package not published: {0}")]
PackageNotPublished(String),
#[error("download server unreachable: {0}")]
NetworkUnreachable(String),
#[error("invalid values: {}", .0.iter().map(|f| format!("{}: {}", f.key, f.message)).collect::<Vec<_>>().join("; "))]
Validation(Vec<FieldError>),
}
@@ -46,6 +50,8 @@ pub enum ErrorCode {
StartupFailed,
HashMismatch,
PathRejected,
PackageNotPublished,
NetworkUnreachable,
Unknown,
}
@@ -126,6 +132,16 @@ impl ErrorCode {
"The requested file location is outside the server folder.",
&[ShowDetails],
),
ErrorCode::PackageNotPublished => (
"This server package is not available yet",
"Nothing has been published at the download location. Try again later, or install from a local package folder (Advanced).",
&[Retry, ShowDetails],
),
ErrorCode::NetworkUnreachable => (
"Could not reach the download server",
"Check your internet connection and try again.",
&[Retry, ShowDetails],
),
ErrorCode::Unknown => ("Something went wrong", "See the technical details.", &[ShowDetails]),
};
Human { code: self, title, message, actions }
@@ -139,6 +155,8 @@ impl Error {
Error::HashMismatch { .. } => ErrorCode::HashMismatch,
Error::PathRejected(_) => ErrorCode::PathRejected,
Error::Validation(_) => ErrorCode::InvalidConfigValue,
Error::PackageNotPublished(_) => ErrorCode::PackageNotPublished,
Error::NetworkUnreachable(_) => ErrorCode::NetworkUnreachable,
_ => ErrorCode::Unknown,
}
}
+4 -1
View File
@@ -28,7 +28,10 @@ pub fn fetch_small(source: &Source, name: &str) -> Result<Vec<u8>> {
let url = format!("{}/{name}", base.trim_end_matches('/'));
download::check_url(&url)?;
let t = download::HttpTransport::new()?;
let reply = download::Transport::get(&t, &url, 0).map_err(|e| Error::Invalid(format!("Could not reach the download server: {e}")))?;
let reply = download::Transport::get(&t, &url, 0).map_err(|e| Error::NetworkUnreachable(format!("{e}")))?;
if reply.status == 404 || reply.status == 410 {
return Err(Error::PackageNotPublished(format!("the download server answered {} for {name} ({url})", reply.status)));
}
if reply.status != 200 {
return Err(Error::Invalid(format!("The download server answered {} for {name}.", reply.status)));
}