What should happen when the assert message expression throws?

Timon Gehr timon.gehr at gmx.ch
Sat Nov 19 12:13:20 UTC 2022


On 11/18/22 13:36, RazvanN wrote:
> Ideally, we could do something along the lines of:
> 
> ```d
> assert(i == 42,
>         (const(char)[] msg,
>          try { msg = format("Bad parameter:", i); },
>          catch (Exception e) { msg = "Assert message evaluation has 
> failed";},
>          msg)
>         );
> ```

Please don't just swallow the exception and error message. This 
particular fix is worse than the problem.



More information about the Digitalmars-d mailing list