try & catch / repeating code - DRY

Robert M. Münch robert.muench at saphirion.com
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 ...);

or

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

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

-- 
Robert M. Münch
http://www.saphirion.com
smarter | better | faster



More information about the Digitalmars-d-learn mailing list