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

2014-12-15 Thread drug via Digitalmars-d-learn
On 15.12.2014 12:22, "Marc Schütz" " wrote: Unfortunately you don't have access to the exception object inside the `scope(failure)` block. Ah, yes, it has to be without msg.msg scope(failure) writeln("Something is wrong");

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

2014-12-15 Thread via Digitalmars-d-learn
On Monday, 15 December 2014 at 07:41:40 UTC, drug wrote: On 13.12.2014 23:26, Suliman wrote: 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.get

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

2014-12-14 Thread drug via Digitalmars-d-learn
On 13.12.2014 23:26, Suliman wrote: 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"); }

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

2014-12-13 Thread Suliman via Digitalmars-d-learn
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"); } catc

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

2014-12-13 Thread Suliman via Digitalmars-d-learn
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) w

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

2014-12-11 Thread Michael via Digitalmars-d-learn
On Thursday, 11 December 2014 at 20:40:40 UTC, Suliman wrote: string dbname = config.getKey("dbname1"); scope(failure) writeln("look like dbname is missing"); I am using dini and trying to throw exception if value can't be extract from config. If I am wrap it's in try-сефср block it's work or.

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

2014-12-11 Thread Suliman via Digitalmars-d-learn
string dbname = config.getKey("dbname1"); scope(failure) writeln("look like dbname is missing"); I am using dini and trying to throw exception if value can't be extract from config. If I am wrap it's in try-сефср block it's work or. But in this situation scope block do not execute and I see on