Tag Archives: exceptions

Throwing exceptions

Throwing exceptions is in itself trivial. Just invoke throw with an exception object. But when should you throw? Should you create a new exception or rethrow an old one? What should you include in the exception info?

Posted in Architecture, CodeProject | Tagged | Leave a comment

How to design exceptions

This article will teach you how you should design your exception classes. It’s a follow up to my previous article which told you what exceptions are and their intended usage.

Posted in Architecture, CodeProject | Tagged | Leave a comment

What are exceptions?

This blog has been quiet for a while. I am currently writing a book about localization. Me and my partner is also getting close to release of our new startup. One of it’s features is to automatically catch unhandled exceptions … Continue reading

Posted in Architecture, CodeProject | Tagged , | 1 Comment

Dealing with exceptions, Logging and displaying error messages

I got a client which is really firm on that the user should know what went wrong when exceptions are thrown. So we are displaying error messages like “The database did not respond” “The database operation failed” “Failed to load … Continue reading

Posted in Architecture, CodeProject | Tagged | 2 Comments

When to throw exceptions

I’ve written several posts about exceptions. For instance when you should catch them or how you should design them. In this post I’ll discuss when you should throw exceptions. Exceptions are thrown when something exceptional have happended. But what does … Continue reading

Posted in Architecture | Tagged , | 2 Comments

How to handle errors in ASP.NET MVC

There are several blog posts regarding error handling for ASP.NET MVC. They use everything from Application_Error to exception handling in the base controller. With this post I’ll show how you can use the built in features in MVC to treat … Continue reading

Posted in CodeProject | Tagged , | 8 Comments

The art of creating exceptions

This will be my final piece on exception handling. It’s been fun, but the show must go on, right? Got any suggestion on what I should rant about in this blog? Leave a comment.
Continue reading

Posted in Architecture, CodeProject | Tagged | Leave a comment

Common mistakes when working with exceptions

There are a few mistakes that’s really common when it comes to exception handling and I though that I should write a small entry about them. Continue reading

Posted in CodeProject | Tagged | Leave a comment

InvalidOperationException: “Exception” in disguise? Or just the new ApplicationException?

Microsoft added ApplicationException with the idea that all exceptions that you made should derive it. Fair point, your should be able to handle your own exceptions, right? The problem is what nobody used it and therefore Microsoft changed it’s recommendation … Continue reading

Posted in Architecture, CodeProject | Tagged | Leave a comment

Do NOT catch that exception!

Ohhh, I’ve recently seen one to many application where the developers try to be safe by catching exceptions all over the place. It can be everything from a small simple method that doesn’t throw that many exceptions to a large method with multiple try/catch statements. Most of those catch blocks just logs the exception and rethrow it.

This post discusses how those problems can be solved. Continue reading

Posted in Architecture, CodeProject | Tagged | 5 Comments