www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Can't break App execution by ctrl+c

reply Suliman <evermind live.ru> writes:
Before my code handle empty result in `catch` block. Then I moved 
it's checking to main loop, and now I can't abort App execution 
by ctrl+c. It's simply continue working.

Here is my code:

	foreach(cargpspoint; cargpspoints)
	{
		auto cmd_dist = new PGCommand(pgconnection, sql_query));
		try
		{
		 auto nresult = cmd_dist.executeQuery();
		 auto nanswer = nresult.array;
		 nresult.close();
		if(nanswer.empty)
		{
		 continue;
		}

	}

OS: Windows.
Apr 27 2017
parent reply Adam D. Ruppe <destructionator gmail.com> writes:
On Thursday, 27 April 2017 at 12:17:12 UTC, Suliman wrote:
 Before my code handle empty result in `catch` block.
You must be catching the ctrl+c exception... don't do that. Just catch the empty result exception.
Apr 27 2017
parent reply Suliman <evermind live.ru> writes:
On Thursday, 27 April 2017 at 12:25:11 UTC, Adam D. Ruppe wrote:
 On Thursday, 27 April 2017 at 12:17:12 UTC, Suliman wrote:
 Before my code handle empty result in `catch` block.
You must be catching the ctrl+c exception... don't do that. Just catch the empty result exception.
The issue is gone after removing http://code.dlang.org/packages/consoled it's look like that it's produced error. Now ctrl+c is woking fine...
Apr 27 2017
parent Suliman <evermind live.ru> writes:
Just catch the empty result exception.
I do not want to go to catch block if I have empty result. I just want to get there if any other error type occur. If result is empty that simply skip this step.
Apr 27 2017