Skip to content

Commit

Permalink
fix(env): Do not print stacktrace for locate workspace (matter-labs#2111
Browse files Browse the repository at this point in the history
)

## What ❔

Do not throw stack trace for already compiled binaries
## Why ❔

Confusing for users
## Checklist

<!-- Check your PR fulfills the following items. -->
<!-- For draft PRs check the boxes as you complete them. -->

- [ ] PR title corresponds to the body of PR (we generate changelog
entries from PRs).
- [ ] Tests for the changes have been added / updated.
- [ ] Documentation comments have been added / updated.
- [ ] Code has been formatted via `zk fmt` and `zk lint`.
- [ ] Spellcheck has been run via `zk spellcheck`.

Signed-off-by: Danil <[email protected]>
  • Loading branch information
vivijj committed Jun 7, 2024
1 parent c8914d8 commit d5fbf49
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/lib/utils/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,12 @@ pub fn locate_workspace() -> Option<&'static Path> {
WORKSPACE
.get_or_init(|| {
let result = locate_workspace_inner();
if let Err(err) = &result {
if result.is_err() {
// `get_or_init()` is guaranteed to call the provided closure once per `OnceCell`;
// i.e., we won't spam logs here.
tracing::warn!("locate_workspace() failed: {err:?}");
tracing::info!(
"locate_workspace() failed. You are using an already compiled version"
);
}
result.ok()
})
Expand Down

0 comments on commit d5fbf49

Please sign in to comment.