An overload of enforceEx which allows constructing the exception with the arguments its ctor supports. The ctor's last parameters must be a string (file) and size_t (line).
1 static class Exc : Exception 2 { 3 this(int x, string file, int line) 4 { 5 super("", file, line); 6 this.x = x; 7 } 8 9 int x; 10 } 11 12 try 13 { 14 enforceEx!Exc(false, 1); 15 assert(0); 16 } 17 catch (Exc ex) 18 { 19 assert(ex.x == 1); 20 }
See Implementation
An overload of enforceEx which allows constructing the exception with the arguments its ctor supports. The ctor's last parameters must be a string (file) and size_t (line).