Now, if you agree that error messages should be generated by the caller, you should agree that getMessage() and getLocalizedMessage() in the Throwable class and its subclasses are pretty much impractical. It forces you to assign a message to the exception, when you have the least information. It may be useful for developers, but for the general user the message will be too nerdy. It’s ok for the exception instance to have that kind of information for tracing on the debugger, but it isn’t something that should be shown on the UI.What’s necessary is for the exception to hold information that can be used eventually to generate the error message. Although you cannot insert additional information for the caller to the standard exception classes, we can add member functions for new classes. For example, it could be beneficial if the exceptions held the name of the file that caused the exception, or the URL, etc.

Contents

Background

Review of Exception Handling Basics

The Requirements

The Three-tiered Exception Handling Architecture

Summary