dtolnay / dtolnay/thiserror

feature request: `#[backtrace]` attr add force option

Open
#321 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
5.5k
Forks
213
PR merge metrics
No merged PRs in 30d

Description

currently the `#[backtrace]` attr has no option, and `thiserror` generated codes always use `Backtrace::capture()`

however, if user want some error always enable backtrace, they have to

- write `impl From Error` manually
- or set env `RUST_BACKTRACE=1`, but that will cause all backtraces are enabled, even they only want to enable a few error backtrace

if `#[backtrace]` add a new option `force`, like `#[backtrace(force=true)]`, when user enable the force capture, `thiserror` generated codes can use `Backtrace::force_capture()` instead of `Backtrace::capture()`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.