scope block do not handle failure, but try-catch does

Suliman via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Dec 13 10:23:45 PST 2014


If I right understand scope is not good for checking if one of 
function is fail.
For example:

string dbpass = config.getKey("dbpass");
string dbpass = config.getKey("dbpass");
string dbhost = config.getKey("dbhost");
string dbport = config.getKey("dbport");

if I will try to add scope(failure) writeln("bla-bla-bla") after 
every function I will execute all writeln("bla-bla-bla") even if 
second function, for example, are failed.

Is there any other way to do not wrap all function in try-catch 
block, but check if they was failed in short form?


More information about the Digitalmars-d-learn mailing list