Board index » cppbuilder » try & catch
Robert G. Hoover
![]() CBuilder Developer |
try & catch2005-07-13 01:31:03 AM cppbuilder55 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 de{*word*81} 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 |