Can I circumvent nothrow?

monarch_dodra via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Apr 27 11:46:10 PDT 2014


On Sunday, 27 April 2014 at 08:04:54 UTC, Andrej Mitrovic via 
Digitalmars-d-learn wrote:
> On 4/27/14, Damian Day via Digitalmars-d-learn
> <digitalmars-d-learn at puremagic.com> wrote:
>> So I have this procedure.
>
> Have a look at std.exception.assumeWontThrow:
> http://dlang.org/phobos/std_exception.html#.assumeWontThrow

Keep in mind that "assume won't throw" will assert *should* an 
exception actually be thrown.

If the function actually can and will throw, but you simply don't 
care, you'd need a "squelchException" (which we don't have), or 
more simply, just:
//----
try {
     myCode();
} catch (Exception){}
//----


More information about the Digitalmars-d-learn mailing list