Skip to content

Commit

Permalink
fix: warn about missing SENTRY_RELEASE when it's set to empty string
Browse files Browse the repository at this point in the history
closes #2385
  • Loading branch information
a-hariti committed Feb 19, 2025
1 parent 6c108fb commit 8f2edee
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,12 @@ impl Config {
matches
.get_one::<String>("release")
.cloned()
.or_else(|| env::var("SENTRY_RELEASE").ok())
.ok_or_else(|| format_err!("A release slug is required (provide with --release)"))
.or_else(|| {
env::var("SENTRY_RELEASE")
.ok()
.and_then(|v| if v.is_empty() { None } else { Some(v) })
})
.ok_or_else(|| format_err!("A release slug is required (provide with --release) or set the SENTRY_RELEASE environment variable"))
}

// Backward compatibility with `releases files <VERSION>` commands.
Expand Down

0 comments on commit 8f2edee

Please sign in to comment.