🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #5762

try & catch

#5762
From: Robert G. Hoover
Date: Tue, 12 Jul 2005 17:31
68 lines
2499 bytes
Hello,

I'm a bit confused on the functionality of the try/catch statements....


// catch infamous "Canvas does not support drawing!" error
try
{
	// update status, immediately
	StatusBar->Caption = "something useful";
	StatusBar->Repaint();
}

// catch exception without losing program integrity
catch (...)
{
	// report error
	WriteErrorToFile("caught exception");
}


The catch is never being executed. The debugger lands on the "Repaint" 
line after the exception is thrown "Canvas does not support drawing!". 
But if I break up the statements into individual try/catch statements, 
the catch executes and writes the entry to my log file. My program 
continues execution as normal. This is preferred.


// catch infamous "Canvas does not support drawing!" error
try
{
	// update status
	StatusBar->Caption = "something useful";
}

// catch exception without losing program integrity
catch (...)
{
	// report error
	WriteErrorToFile("caught exception");
}


// catch infamous "Canvas does not support drawing!" error
try
{
	// update GUI
	StatusBar->Repaint();
}

// catch exception without losing program integrity
catch (...)
{
	// report error
	WriteErrorToFile("caught exception");
}


Has anyone experienced similar behavior. Do I need to put a try/catch 
around every single GUI statement? My program does very sophisticated 
image acquisition, processing, and analysis and keeps crashing out 
because of this "Canvas does not support drawing!", resulting in 
incomplete acquisition runs.

Help please... thanks so much!


Rob
Technical Details
Message-ID: <42d3fe5e@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news2.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,40a42ffcaae937ff,start
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Tue, 12 Jul 2005 13:31:03 -0400
From: "Robert G. Hoover" <not.a.real.address@anywhere.sorry>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.7) Gecko/20050414
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: try & catch
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 67.142.36.34
Message-ID: <42d3fe5e@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1121189470 67.142.36.34 (12 Jul 2005 10:31:10 -0700)
Lines: 68
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news2.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail