exceptions (1,592)


c# - Unhandled Exception Handler in.NET 1.1

c# - Unhandled Exception Handler in.NET 1.1

I'm maintaining a.NET 1.1 application, and one of the things I've been tasked with is making sure the user doesn't see any unfriendly error notifications. I've added handlers to Application.ThreadEx…


c++ - Ensuring that Exceptions are always сaught

Exceptions in C++ don't need to be caught(no compile time errors) by the calling function. So it's up to developer's judgment whether to catch them using try/catch(unlike in Java). Is there a way o…


Reducing duplicate error handling code in C#?

I've never been completely happy with the way exception handling works, there's a lot exceptions and try/catch brings to the table(stack unwinding, etc.), but it seems to break a lot of the OO model…



Global Exception Handling for winforms control

When working on ASP.NET 1.1 projects I always used the Global.asax to catch all errors. I'm looking for a similar way to catch all exceptions in a Windows Forms user control, which ends up being a hos…


.net - Performance Considerations for throwing Exceptions

I have come across the following type of code many a times, and I wonder if this is a good practice(from Performance perspective) or not: try{...// some code}catch(Exception ex){...…


Java+Tomcat, Dying database connection?

I have a tomcat instance setup but the database connection I have configured in context.xml keeps dying after periods of inactivity. When I check the logs I get the following error: com.mysql.jdbc.ex…


Do you write exceptions for specific issues or general exceptions?

I have some code that gives a user id to a utility that then send email to that user. emailUtil.sendEmail(userId, "foo"); public void sendEmail(String userId, String message) throws MailException{…


Is it really that bad to catch a general exception?

Whilst analysing some legacy code with FXCop, it occurred to me is it really that bad to catch a general exception error within a try block or should you be looking for a specific exception. Thoughts…


c# - Best practices for catching and re-throwing.NET exceptions

What are the best practices to consider when catching exceptions and re-throwing them? I want to make sure that the Exception object's InnerException and stack trace are preserved. Is there a differen…


Exception handling: Contract vs Exceptional approach

I know two approaches to Exception handling, lets have a look at them. Contract approach. When a method does not do what it says it will do in the method header, it will throw an exception. Thus the…




exception catch handling throw all try best practices error custom