error-chain icon indicating copy to clipboard operation
error-chain copied to clipboard

Add a feature gate to call DebugBreak on construction

Open AqlaSolutions opened this issue 4 years ago • 0 comments
trafficstars

On Windows, when appropriate feature is enabled, it would be cool to be able to run this kind of code when constructing a Error struct:

    if (unsafe { winapi::um::debugapi::IsDebuggerPresent() != 0 })
    {
         unsafe { winapi::um::debugapi::DebugBreak(); }
    }

It would cause the debugger, if attached, to break at the time of error construction so it's possible to see the stack locals and even interact with things.

AqlaSolutions avatar Dec 07 '20 16:12 AqlaSolutions