The interface to the error handling is the class Error, which is an abstract interface for the error handling object. There is a single global error handler; the variable errHandler is a reference to it. This object implements a default error handling mechanism, but one can register one's own error handler. This error handler should implement the ErrorHandler interface.
The Error interface is implemented by the class ErrorDispatcher. The variable errHandler points to a global object of this type. It contains its own default error handler, of type SimpleHandler. When one registers another error handler derived from ErrorHandler, this handler will replace SimpleHandler.
The Sas::error call on the errstr will generate an error object. The output operator of this object will call the error member function of the global error object, which will then take the appropriate action. The other messages are implemented similarly.