diff --git a/leo/errors/mod.rs b/leo/errors/mod.rs
index bc7859ca5d..9fa3bd3d12 100644
--- a/leo/errors/mod.rs
+++ b/leo/errors/mod.rs
@@ -19,3 +19,6 @@ pub use self::cli::*;
pub mod commands;
pub use self::commands::*;
+
+pub mod updater;
+pub use self::updater::*;
diff --git a/leo/errors/updater.rs b/leo/errors/updater.rs
new file mode 100644
index 0000000000..8bfa4bdec9
--- /dev/null
+++ b/leo/errors/updater.rs
@@ -0,0 +1,31 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
+#[derive(Debug, Error)]
+pub enum UpdaterError {
+ #[error("{}: {}", _0, _1)]
+ Crate(&'static str, String),
+
+ #[error("The current version {} is more recent than the release version {}", _0, _1)]
+ OldReleaseVersion(String, String),
+}
+
+impl From for UpdaterError {
+ fn from(error: self_update::errors::Error) -> Self {
+ tracing::error!("{}\n", error);
+ UpdaterError::Crate("self_update", error.to_string())
+ }
+}
diff --git a/leo/updater.rs b/leo/updater.rs
index 84f088f68f..a37ee7d184 100644
--- a/leo/updater.rs
+++ b/leo/updater.rs
@@ -13,7 +13,7 @@
// You should have received a copy of the GNU General Public License
// along with the Leo library. If not, see .
-use crate::config::Config;
+use crate::{config::Config, errors::UpdaterError};
use colored::Colorize;
use self_update::{backends::github, version::bump_is_greater, Status};
@@ -27,7 +27,7 @@ impl Updater {
const LEO_REPO_OWNER: &'static str = "AleoHQ";
/// Show all available releases for `leo`.
- pub fn show_available_releases() -> Result<(), self_update::errors::Error> {
+ pub fn show_available_releases() -> Result<(), UpdaterError> {
let releases = github::ReleaseList::configure()
.repo_owner(Self::LEO_REPO_OWNER)
.repo_name(Self::LEO_REPO_NAME)
@@ -42,7 +42,7 @@ impl Updater {
}
/// Update `leo` to the latest release.
- pub fn update_to_latest_release(show_output: bool) -> Result {
+ pub fn update_to_latest_release(show_output: bool) -> Result {
let status = github::Update::configure()
.repo_owner(Self::LEO_REPO_OWNER)
.repo_name(Self::LEO_REPO_NAME)
@@ -58,7 +58,7 @@ impl Updater {
}
/// Check if there is an available update for `leo` and return the newest release.
- pub fn update_available() -> Result