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

Suliman via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Dec 13 11:26:19 PST 2014


I reread docs and understood that scope not for such case.

Next code is do what I need:
try
{
	string dbname = config.getKey("dbname");
	string dbpass = config.getKey("dbpass");
	string dbhost = config.getKey("dbhost");
	string dbport = config.getKey("dbport");
}

catch (Exception msg)
{
	writeln("Can't parse config: %s", msg.msg);
}


More information about the Digitalmars-d-learn mailing list