Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TNMPOP3 Error Handling

Status
Not open for further replies.

Wings

Programmer
Feb 14, 2002
247
US
Hi,
Does anyone know the correct way to begin handling errors in the NMPOP3 componet of Borland Builder 5?
I know to go into the event handlers of the component, but what do I do from there? I want to create an email application but if the authentication fails, it crashes.

Thanks for the help
 
Look at the try statements. You have try ... catch and try ... __finally. The try ... catch statement trys someting and if there is an exception it catches it. The __finally statment will execute no matter what so you can clean up any objectes created in the try statement.


James P. Cottingham

When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute and it's longer than any hour. That's relativity.
[tab][tab]Albert Einstein explaining his Theory of Relativity to a group of journalists.
 
Thanks,
I know how to use try ... catch statements, but what am I actually testing for? what would go into the statments? Any examples would greatly help.

Thanks again
 
You could catch all exceptions with
Code:
try
{
   // start pop
}
catch ( ... )
{
   // do something 
}

If you know which exception to catch you can use it. This usually required digging into the tech manual to find it.

For example, catch (const EIntegerRange &rangeErr) will catch an error when an integer value is too big. Note that you should always catch BCB exceptions by reference and not directly.

James P. Cottingham

When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute and it's longer than any hour. That's relativity.
[tab][tab]Albert Einstein explaining his Theory of Relativity to a group of journalists.
 
You might be able to find out which exception is being thrown by paying attention to the error that pops up when you don't use a try/catch pair. Borland sometimes (all the time?) will display what exception occured (Exception EError) in the dialog box that comes up. You may have to play with your debugging parameters to get it to display if it does not. Best idea is to just use the ...

Good luck,
Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top