Skip to content

Commit

Permalink
feat: ability to get message without source from NpmVersionParseError
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret committed Jan 18, 2024
1 parent dda7291 commit 9a04df2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ authors = ["the Deno authors"]
license = "MIT"

[dependencies]
monch = "0.4.3"
monch = "0.5.0"
once_cell = "1.17.0"
serde = { version = "1.0.130", features = ["derive", "rc"] }
thiserror = "1.0.24"
Expand Down
6 changes: 6 additions & 0 deletions src/npm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ pub struct NpmVersionParseError {
pub(crate) source: ParseErrorFailureError,
}

impl NpmVersionParseError {
pub fn message(&self) -> &str {
&self.source.message
}
}

pub fn parse_npm_version(text: &str) -> Result<Version, NpmVersionParseError> {
let text = text.trim();
with_failure_handling(|input| {
Expand Down

0 comments on commit 9a04df2

Please sign in to comment.