BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Exceptions

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (IDE)
View previous topic :: View next topic  
Author Message
crhras
Guest





PostPosted: Fri Aug 25, 2006 4:50 am    Post subject: Exceptions Reply with quote



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
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Fri Aug 25, 2006 7:12 am    Post subject: Re: Exceptions Reply with quote



"crhras" <crhras (AT) sbcglobal (DOT) net> wrote in message
news:44ee3b53$1 (AT) newsgroups (DOT) borland.com...

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 debugger can determine the exact
exception type that is being thrown, because that is what a debugger is
designed to do.


Gambit
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (IDE) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.