Derives from kdu_message
[Declared in "../coresys/common/kdu_messaging.h"]
Objects of this class may be created, written to and then destroyed as a compact and powerful mechanism for generating error messages and jumping out of the immediate execution context. All text is delivered to the kdu_message-derived object supplied in the most recent call to the kdu_customize_errors function. The kdu_error object's destructor plays a key role in completing errors. It first invokes the output object's kdu_message::flush function with an end_of_message argument equal to true, and then terminates the process through the system exit function.
To avoid process termination, the caller may supply a special kdu_message-derived object to kdu_customize_errors which overrides the flush function so as to throw an exception in the event that its flush member is called with end_of_message equal to true. This condition is guaranteed not to occur until the kdu_error object is destroyed.
The following code-fragment illustrates typical usage: { kdu_error e; if (error) { kdu_error e; e << "Oops! Don't do that."; }}
In view of the preceding discussion, it should be clear that kdu_error objects should never be created on the heap.