Name

Warning, Error -- report of some condition occurring during program execution

(.. This section of documentation is only a start.)


Synopsis

//
// EventType -- report of some condition occurring during program execution
//
@deftype EventType 
- (void)	raiseEvent;
- (void)	raiseEvent: (void *)eventData, ...;
@end

//
// Warning -- a condition of possible concern to a program developer   
//
@deftype Warning 
- (void)	setMessageString: (char *)messageString;
- (char *)	getMessageString;
@end

//
// Error -- a condition which prevents further execution
//
@deftype Error 
@end

Description

Warning and Event are object types (both subtypes of EventType) that may be used to report conditions detected during program execution. A warning is a condition of possible interest to a developer or user, but one that does not prevent further execution. An error is a condition which prevents further execution of the program.

Warning and Event also inherit from Symbol, so that each type of warning or error may be given a unique global name. Any library may publish its own warning and event names as part of its documented library interface (see module definition conventions for standard methods of declaring interface symbols in a library header file.)

These predefined warning and event types are typically used not directly by the messages defined above, but by the following macro defined in defobj.h:

#define raiseEvent( eventType, formatString, args... )
This macro raises an event of the type identified by the first argument. Default handling of the event is to print a formatted message including standard header and trailer lines, and then either to continue (in the case of a Warning) or to terminate the program in the case of Error). The standard header lines include the file, function, and line number where the macro that raised the event was executed.

If the formatString argument is nil, a default message string already established as part of the warning or event type is used to report the error. Otherwise, the formatString argument must be a null-terminated C character string that overrides the default string.

Either the default or replacement message string may contain printf-style formatted field definitions. For each formatted field definition, an argument value must be supplied in the args... section of the macro. (The support of the GNU C compiler for macros with variable argument lists is used by the macro.)

(.. Methods for defining new event types as part of a library implementation are not currently documented. Instead, just use the raiseEvent macro on one of the predefined Warning or Event Types if you want to raise an event using this standard mechanism. Eventually, this standard mechanism will be used to handle warnings and errors under various forms of logging exception handling support.)

Standard Error and Warning Types

The following standard error and warning types are defined by the defobj library. Thesy may also be used by other libraries for errors or warnings that fit within these standard predefined categories:


//
// standard errors
//
extern id 
  SourceMessage,          // message in the source defines error
  NotImplemented,         // requested behavior not implemented by object
  SubclassMustImplement,  // requested behavior must be implemented by subclass
  InvalidCombination,     // invalid combination of set messages for create
  InvalidArgument,        // argument value not valid
  CreateSubclassing,      // improper use of Create subclassing framework
  CreateUsage,            // incorrect sequence of Create protocol messages
  OutOfMemory,            // no more memory available for allocation
  InvalidAllocSize,       // no more memory available for allocation
  InternalError;          // unexpected condition encountered in program

//
// standard warnings
//
extern id 
  WarningMessage,         // message in the source defines warning
  LibraryUsage,           // invalid usage of library interface
  DefaultAssumed,         // non-silent use of default
  ObsoleteMessage,        // using feature which could be removed in future
  ObsoleteFeature,        // using feature which could be removed in future
  ResourceAvailability;   // resource from runtime environment not available

Roger Burkhart <rmb@santafe.edu>
Last modified: