Try/Catch with version condition

Walter Bright newshound2 at digitalmars.com
Tue Apr 9 23:28:23 UTC 2019


On 4/9/2019 7:43 AM, foo wrote:
> How would I get this to work:

Nested functions:

  void bar() {
      throw new Exception("This should only be fatal when the version is not 
'foo'.");
  }

  version (foo) {
     try { bar(); }
     catch (Exception e) {
         import std.stdio;
         writeln(e);
     }
  }
  else
     bar();


More information about the Digitalmars-d mailing list