How to use exceptions

Adam D Ruppe destructionator at gmail.com
Fri Aug 12 00:12:13 UTC 2022


On Thursday, 11 August 2022 at 23:50:58 UTC, H. S. Teoh wrote:
> I think the OP's idea is somewhat different: adding contextual 
> information to a propagating exception that the throwing code 
> may not have access to.

Yeah, but you can use the mechanism again: you'd catch the one 
then throw a new one with the old one tacked on the back.

> The OP's idea of wrapping throwing code with a function that 
> tacks on extra information is a good idea.

Yeah, that is good. I also kinda wish that scope(failure) could 
do it so you could tack on info with a more convenient syntax... 
i have some more wild ideas brewing now lol


More information about the Digitalmars-d-learn mailing list