call traceback is indecipherable garbage

kinke noone at nowhere.com
Fri Feb 4 19:04:24 UTC 2022


On Wednesday, 26 January 2022 at 21:11:42 UTC, H. S. Teoh wrote:
> On Wed, Jan 26, 2022 at 09:02:09PM +0000, forkit via 
> Digitalmars-d wrote:
>> On Wednesday, 26 January 2022 at 02:20:17 UTC, forkit wrote:
>> > 
>> btw. I really like how Rust does it:
>> 
>> just set an environment variable (set RUST_BACKTRACE=1)
>> 
>> then run your program, and it will dump the backtrace, when 
>> you run your program.
> [...]
>
> File this as an enhancement request, it might be worth 
> implementing.

One can easily disable any exception traces via 
https://dlang.org/phobos/core_runtime.html#.Runtime.traceHandler:
```
void main() {
     import core.runtime : Runtime;
     Runtime.traceHandler = null;

     throw new Exception("oops");
}
```

[That won't just avoid the output, but also makes EH faster.]

One can also set a custom function, e.g., to make tracing depend 
on some environment variable, reusing 
https://dlang.org/phobos/core_runtime.html#.defaultTraceHandler.


More information about the Digitalmars-d mailing list