Best way to bubble up error message from callee to caller?

J

John Dalberg

Using C#.

I have a web form that creates a new class. The class gets records from a
database.

What's the best practice for error handling? Do you put a try/catch in the
form code that calls the class's function AND in the the class too? How do
you pass the error message from the class to the form to be displayed for
the user? The class can be used by multiple web pages.

In the class, do you catch the exception and throw it again for the caller
to get?

Or do you catch the exception in the class and return false as a failed
status to the caller and display an error message for a generic failure?

J.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top