|
|
|
|
|
by more-nitor
385 days ago
|
|
hmm this might be solved in some simple ways: 1. create `with_err` function:
some_mayerr_func().with_err_log()? 2. add 'newbie beginner mode(default)' / 'expert mode (optimized)' for rust: - current Rust default is a bit too focused on code-optimization, too much so that it defaults to removing backtrace - default should be 'show every backtrace even for handled errors (in my code, not the lib code -- bonus points for "is handled" checkbox)' |
|
Your second idea is interesting, but I feel like it would be too magical for Rust. You fundamentally need a Backtrace field to add backtraces to your error types. Adding an invisible, inaccessible, always-implicitly-initialized field sounds too weird and non-Rusty to me. The language doesn't have anything like that right now.
Also, which types should even get this special field? Every type that implements the Error trait? Again, it's a very weird special case full of magic.