Chapter 10. Programming with Exceptions

In procedural programming, the status of a function call is often returned as an integer result code. The client code (which makes the function call) then uses this code to determine the branching of the program. Upon return of an error integer code in GUI applications, a dialog box indicating an error status is often displayed to the end user. COM programmers are familiar with the HRESULT return value, which is returned by COM components.

But using result codes has several deficiencies:

  • The client code (which makes the function call) must understand the various result codes returned by the function.

  • Depending on the specificity of the result code, the client code gets some idea of what went wrong inside ...

Get .NET for Java Developers: Migrating to C# now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.