try/catch idiom in std.datetime

Jesse Phillips Jesse.K.Phillips+D at gmail.com
Thu Nov 21 19:03:15 PST 2013


On Friday, 22 November 2013 at 02:35:40 UTC, Shammah Chancellor 
wrote:
> void someFunc() // nothrow
> {
>    scope(failure) { writeln("What?");} <-- NEVER EXECUTED?!
>     scope(failure) {
>         writeln("Failed in someFunc()");
>         return;
>     }
>     throwingFunction();
> }

That does exactly as expected:

void someFunc()
{
     try {
         try {
             throwingFunction();
         } catch {
             writeln("Failed in someFunc()");
             return;
         }
     } catch {
         writeln("What?");
     }
}


More information about the Digitalmars-d mailing list