Board index » cppbuilder » exceptions

exceptions


2006-02-28 06:43:03 PM
cppbuilder10
Hi everyone. I want to implement some kind of bug report to my program.
The idea is that whenever an exception occurs a form will appear after
the exception to allow the user to fill out a brief report which is then
emailed to me. Rather put a try catch in the body of each method I
though it would e easier to implement it in my main .cpp fiole, ie
Project1.cpp but I can't seem to figure out how to do this. Am I right
in assuming that Project1.cpp catches all exceptions? If anyone could
point out how I do this it would be great. I have a form ready to go, I
just don't know how to make it appear after an exception from
Project1.cpp. Thanks,
Rory.
 
 

Re:exceptions

Hi everyone. I want to implement some kind of bug report to my program.
The idea is that whenever an exception occurs a form will appear after
the exception to allow the user to fill out a brief report which is then
emailed to me. Rather put a try catch in the body of each method I
though it would e easier to implement it in my main .cpp file, i.e.
Project1.cpp but I can't seem to figure out how to do this. Am I right
in assuming that Project1.cpp catches all exceptions? If anyone could
point out how I do this it would be great. I have a form ready to go, I
just don't know how to make it appear after an exception from
Project1.cpp. Thanks,
Rory.
 

Re:exceptions

Rory Walsh wrote:
Quote
Hi everyone. I want to implement some kind of bug report to my program.
The idea is that whenever an exception occurs a form will appear after
the exception to allow the user to fill out a brief report which is then
emailed to me. Rather put a try catch in the body of each method I
though it would e easier to implement it in my main .cpp file, i.e.
Project1.cpp but I can't seem to figure out how to do this. Am I right
in assuming that Project1.cpp catches all exceptions? If anyone could
point out how I do this it would be great. I have a form ready to go, I
just don't know how to make it appear after an exception from
Project1.cpp. Thanks,
Rory.
I can highly recommend madExcept:
www.madshi.net/madExceptDescription.htm
I've been using it for a while, both I and my customer are very pleased
with it...
It's a lot easier and cheaper than trying to roll your own (far more
complete, too).
David Erbas-White
 

{smallsort}

Re:exceptions

Wow! That should take care of it alright!
Rory.
Quote
I can highly recommend madExcept:

www.madshi.net/madExceptDescription.htm

I've been using it for a while, both I and my customer are very pleased
with it...

It's a lot easier and cheaper than trying to roll your own (far more
complete, too).

David Erbas-White
 

Re:exceptions

Quote
I can highly recommend madExcept:

www.madshi.net/madExceptDescription.htm

I've been using it for a while, both I and my customer are very pleased
with it...
Amen to that!
 

Re:exceptions

One thing however, I tried to create release and found that I needed to
include some dll's with my application? I would rather not, can this be
avoided?
Leroy Casterline wrote:
Quote
>I can highly recommend madExcept:
>
>www.madshi.net/madExceptDescription.htm
>
>I've been using it for a while, both I and my customer are very pleased
>with it...

Amen to that!
 

Re:exceptions

How can I find the exceptions that a method might throw ?
For example, I want to put a call to TDataset->Post() inside a try/catch
block and I can't find the possible exceptions. I am asking this question
here because it seems like the IDE might be able to pull this info up.
Thanks,
Curt
 

Re:exceptions

"crhras" < XXXX@XXXXX.COM >wrote in message
Quote
How can I find the exceptions that a method might throw ?
Unless it is in the method's documentation, or you have the method's source
code, then you don't.
Quote
For example, I want to put a call to TDataset->Post() inside a
try/catch block and I can't find the possible exceptions.
You don't need to know every possible specific exception type in order to do
that. All VCL exceptions ultimately derive from the Exception class, so you
can catch that instead, ie:
try
{
Dataset1->Post();
}
catch(const Exception &e) // all VCL exceptions
{
ShowMessage("Exception Type: " + AnsiString(e.ClassName) + ",
Message: " + e.Message);
}
Quote
I am asking this question here because it seems like the
IDE might be able to pull this info up.
That is a very different issue. The IDE's de{*word*81} can determine the exact
exception type that is being thrown, because that is what a de{*word*81} is
designed to do.
Gambit
 

Re:exceptions

I am not sure what newsgroup to put this in!
I am using a 3rd party component, TComPort, which I sometimes need to use
with a USB to Serial converter. I have the port open and working fine, but
sometimes the user disconnects the USB to Serial converter. Then when my
application exits, I call the
ComPort->Close()
function and I get a Purge Comm error. The port can't be closed because it
no longer exists. My app will not longer close. I tried putting a
try()
{
ComPort->Close();
}
catch(...)
{
//Error message
}
I tried a few different catch statements, like
catch (const Exception &exception)
I am just not good with exceptions. My error message gets displayed, but
then I get a CodeGuard error and 5 more errors after the CodeGuard error
"The exception unknown software exception (0x...) occured in the application
at location 0x.....), and "Abnormal program termination".
Can someone let me know how to get my exception working properly ?
Thanks!
Doug
 

Re:exceptions

Hi,
I have some example code as below:-
ClearShutdownFlag->Close();
CleaShutdownFlag->ParamByName("ID")->AsString = IDLetter;
CleaShutdownFlag->Prepare();
//
try
{
ClearShutdownFlag->ExecSQL();
IBTransaction1->Commit();
}
catch ( EIBError &err )
{
IBTransaction1->Rollback();
ClearShutdownFlag->Close();
}
If I purposely deadlock the table, by poking some value in the table (via
IBConsole), then this code correctly deadlocks.
However, I want to be able to handle the deadlock in code, and not have the
app throw an exception window.
Is it possible to inhibit the app throwing up the window informing me "lock
conflict on no wait trasnacion deadlock"?
Thanks