Skip to content

Commit ed71679

Browse files
authored
refactor(updater): improve unsupported error variants, closes #3817 (#3849)
1 parent 6839fde commit ed71679

3 files changed

Lines changed: 19 additions & 6 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri": patch
3+
---
4+
5+
**Breaking change**: Removed the `tauri::updater::Error::UnsupportedPlatform` variant and added `UnsupportedLinuxPackage`, `UnsupportedOs` and `UnsupportedArch` for better error information.

core/tauri/src/updater/core.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,8 @@ impl<R: Runtime> UpdateBuilder<R> {
312312
let target = self
313313
.target
314314
.or_else(|| get_updater_target().map(Into::into))
315-
.ok_or(Error::UnsupportedPlatform)?;
316-
let arch = get_updater_arch().ok_or(Error::UnsupportedPlatform)?;
315+
.ok_or(Error::UnsupportedOs)?;
316+
let arch = get_updater_arch().ok_or(Error::UnsupportedArch)?;
317317
let json_target = if has_custom_target {
318318
target.clone()
319319
} else {
@@ -498,7 +498,7 @@ impl<R: Runtime> Update<R> {
498498
// anythin with it yet
499499
#[cfg(target_os = "linux")]
500500
if self.app.state::<Env>().appimage.is_none() {
501-
return Err(Error::UnsupportedPlatform);
501+
return Err(Error::UnsupportedLinuxPackage);
502502
}
503503

504504
// set our headers

core/tauri/src/updater/error.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,17 @@ pub enum Error {
4141
/// Error building updater.
4242
#[error("Unable to extract the new version: {0}")]
4343
Extract(String),
44-
/// Updater is not supported for current operating system or platform.
45-
#[error("Unsupported operating system or platform")]
46-
UnsupportedPlatform,
44+
/// Updater cannot be executed on this Linux package. Currently the updater is enabled only on AppImages.
45+
#[error("Cannot run updater on this Linux package. Currently only an AppImage can be updated.")]
46+
UnsupportedLinuxPackage,
47+
/// Operating system is not supported.
48+
#[error("unsupported OS, expected one of `linux`, `darwin` or `windows`.")]
49+
UnsupportedOs,
50+
/// Unsupported app architecture.
51+
#[error(
52+
"Unsupported application architecture, expected one of `x86`, `x86_64`, `arm` or `aarch64`."
53+
)]
54+
UnsupportedArch,
4755
/// The platform was not found on the updater JSON response.
4856
#[error("the platform `{0}` was not found on the response `platforms` object")]
4957
TargetNotFound(String),

0 commit comments

Comments
 (0)