Skip to content

Commit

Permalink
fix: don't capture backtraces by default
Browse files Browse the repository at this point in the history
Call `Backtrace::capture()` instead of the `Backtrace::generate()`
method provided by snafu. This disables backtrace capturing unless
either the `RUST_BACKTRACE` or `RUST_LIB_BACKTRACE` environment
variables are set at runtime.

Refs: #649
  • Loading branch information
benpueschel committed Oct 6, 2024
1 parent 9fbf59c commit 1f99c01
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/api/orgs/secrets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ impl<'octo> OrgSecretsHandler<'octo> {
status_code.as_str()
)
.into(),
backtrace: snafu::Backtrace::generate(),
backtrace: snafu::Backtrace::capture(),
}),
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/api/repos/secrets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ impl<'octo> RepoSecretsHandler<'octo> {
status_code.as_str()
)
.into(),
backtrace: snafu::Backtrace::generate(),
backtrace: snafu::Backtrace::capture(),
}),
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/api/users.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ impl<'octo> UserHandler<'octo> {
errors: None,
message: "".to_string(),
},
backtrace: Backtrace::generate(),
backtrace: Backtrace::capture(),
}),
Err(_v) => Ok(()),
}
Expand Down
2 changes: 1 addition & 1 deletion src/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ where
try_downcast(body).unwrap_or_else(|body| {
body.map_err(|e| crate::Error::Other {
source: e.into(),
backtrace: Backtrace::generate(),
backtrace: Backtrace::capture(),
})
.boxed()
})
Expand Down
2 changes: 1 addition & 1 deletion src/etag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl EntityTag {
.parse()
.map_err(|err: InvalidHeaderValue| crate::Error::InvalidHeaderValue {
source: err,
backtrace: snafu::Backtrace::generate(),
backtrace: snafu::Backtrace::capture(),
})?,
);
Ok(())
Expand Down
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ pub async fn map_github_error(
errors,
message,
},
backtrace: Backtrace::generate(),
backtrace: Backtrace::capture(),
})
}
}
Expand Down Expand Up @@ -1015,7 +1015,7 @@ impl Octocrab {
app_auth.clone()
} else {
return Err(Error::Installation {
backtrace: Backtrace::generate(),
backtrace: Backtrace::capture(),
});
};
Ok(Octocrab {
Expand Down Expand Up @@ -1502,7 +1502,7 @@ impl Octocrab {
(app, installation, token)
} else {
return Err(Error::Installation {
backtrace: Backtrace::generate(),
backtrace: Backtrace::capture(),
});
};
let mut request = Builder::new();
Expand Down Expand Up @@ -1534,7 +1534,7 @@ impl Octocrab {
.map(|time| {
DateTime::<Utc>::from_str(&time).map_err(|e| error::Error::Other {
source: Box::new(e),
backtrace: snafu::Backtrace::generate(),
backtrace: snafu::Backtrace::capture(),
})
})
.transpose()?;
Expand Down
2 changes: 1 addition & 1 deletion src/page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ fn get_links(headers: &http::header::HeaderMap) -> crate::Result<HeaderLinks> {
if let Some(link) = headers.get("Link") {
let links = link.to_str().map_err(|err| crate::Error::Other {
source: Box::new(err),
backtrace: snafu::Backtrace::generate(),
backtrace: snafu::Backtrace::capture(),
})?;

for url_with_params in links.split(',') {
Expand Down

0 comments on commit 1f99c01

Please sign in to comment.