Article View: borland.public.cppbuilder.nativeapi
Article #5764Re: try & catch
From: Remy Lebeau (TeamB)
Date: Tue, 12 Jul 2005 18:47
Date: Tue, 12 Jul 2005 18:47
38 lines
2457 bytes
2457 bytes
"Robert G. Hoover" <not.a.real.address@anywhere.sorry> wrote in message
news:42d3fe5e@newsgroups.borland.com...
> catch (...)
Which version of BCB are you actually using? If BCB6, then '...' does not
havdle VCL exceptions as well as it did in previous versions. You should
always catch VCL exceptions by type explicitally:
catch (const Exception &)
> The catch is never being executed. The debugger lands on the
> "Repaint" line after the exception is thrown "Canvas does not
> support drawing!".
The exception is liely being handled by the VCL internally so that your own
code never sees it. Of course, the debugger sees all exceptions regardless
of where they are thrown or how they are handled. Pressing F9 passes the
exception back to the application for normal handling.
> But if I break up the statements into individual try/catch
> statements, the catch executes and writes the entry to my log file.
There is no difference between having 1 try/catch block or multiple. An
exception is an exception, and if it actually reaches your code, having a
single try/catch block will handle it just as well as multiple blocks.
> 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.
The best way to handle an exception is to not cause an exception to be
thrown in the first place. Are you locking the Canvas every time you draw
on it? Are you drawing on it from multiple threads at the same time?
Gambit
Technical Details
Message-ID:
<42d41033$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<42d3fe5e@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,40a42ffcaae937ff X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <42d3fe5e@newsgroups.borland.com> Subject: Re: try & catch Date: Tue, 12 Jul 2005 11:47:01 -0700 Lines: 40 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 68.69.17.41 Message-ID: <42d41033$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1121194035 68.69.17.41 (12 Jul 2005 11:47:15 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail