-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…135) Resolves #128 This PR adds a new error `RepoError::NotFound` and uses it when fetch_release_info returns 404. The error message depends on the tag, and could be either ❌ **bottom** The clementtsang/bottomx doesn't exist or tags/0.66.3 was not found. or ❌ **bottom** The clementtsang/bottomx doesn't exist or has no releases. if the tag is latest. ### Additional tasks - [ ] Documentation for changes provided/changed - [ ] Tests added - [x] Updated CHANGELOG.md
- Loading branch information
Showing
4 changed files
with
47 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
pub mod asset_name; | ||
pub mod os; | ||
pub mod release; | ||
pub mod repo; | ||
pub mod tool; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use crate::model::tool::ToolInfoTag; | ||
use std::fmt::{Display, Formatter}; | ||
|
||
#[derive(Debug, PartialEq, Eq)] | ||
pub enum RepoError { | ||
/// Either repository or tag is not found due to misconfiguration | ||
NotFound { | ||
owner: String, | ||
repo: String, | ||
tag: ToolInfoTag, | ||
}, | ||
} | ||
|
||
impl Display for RepoError { | ||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { | ||
match self { | ||
RepoError::NotFound { owner, repo, tag } => match tag { | ||
ToolInfoTag::Latest => { | ||
write!(f, "The {owner}/{repo} doesn't exist or has no releases.") | ||
} | ||
_ => write!( | ||
f, | ||
"The {owner}/{repo} doesn't exist or {tag} was not found.", | ||
tag = tag.to_str_version() | ||
), | ||
}, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters