Skip to content

Commit 3aec39d

Browse files
feat(api): More descriptive releases propose-version error (#1854)
When the sentry-cli releases propose-version command fails to automatically determine a release name, it will output a more descriptive error message. The new error message specifically directs users to ensure their version control system is properly configured. Fixes GH-1853
1 parent c09c599 commit 3aec39d

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/utils/releases.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::fs;
44
use std::io::Read;
55
use std::path::{Path, PathBuf};
66

7-
use anyhow::{bail, Result};
7+
use anyhow::{anyhow, Result};
88
use if_chain::if_chain;
99
use lazy_static::lazy_static;
1010
use regex::Regex;
@@ -142,9 +142,12 @@ pub fn detect_release_name() -> Result<String> {
142142
return Ok(release);
143143
}
144144

145-
if let Ok(head) = vcs::find_head() {
146-
Ok(head)
147-
} else {
148-
bail!("Could not automatically determine release name");
145+
match vcs::find_head() {
146+
Ok(head) => Ok(head),
147+
Err(e) => Err(anyhow!(
148+
"Could not automatically determine release name:\n\t {e} \n\n\
149+
Please ensure your version control system is configured correctly, \
150+
or provide a release name manually."
151+
)),
149152
}
150153
}

0 commit comments

Comments
 (0)