O'Reilly logo

Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries by Brad Abrams, Krzysztof Cwalina

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 7. Exceptions

There are many benefits to exception handling as compared to return-value-based error reporting. Good framework design helps the application developer realize the benefits of exceptions. This section discusses the benefits of exceptions and presents guidelines for using them effectively.

  • Exceptions promote API consistency. This is because they are designed to be used for failure reporting and nothing else. In contrast, return values have many uses, of which failure reporting is only a subset. For this reason, it is likely that APIs that report failure through return values will find a number of patterns, whereas exceptions can be constrained to specific patterns. The Win32 API is a clear example of this inconsistency through ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required