try & catch / repeating code - DRY

Robert M. Münch robert.muench at
Tue May 22 18:20:43 UTC 2018

I see that I'm writing

try {
 ... different code ...
} catch (myException e) {
	... same handling code ...

over and over again.

Of course I can put the exception handling code into a function to not 
duplicate it. However, I still need to write this construct over and 
over again. Is there a way to handle it more generic? Like:

??? (... code ...);


??? { ... code ...};

Where ??? would do the try and re-use the exception handling code 
everytime? I hope this is understandable.

Robert M. Münch
smarter | better | faster

More information about the Digitalmars-d-learn mailing list