previous next

Chapter 15: Status Codes and Errors

Any RealSystem component can report errors to RealSystem. On a RealSystem client, these error messages display in a pop-up dialog box. On RealServer, the errors are recorded in the system error log file, the location and name of which is determined by the ErrorLogPath parameter in the RealServer configuration file. Through the RealSystem interfaces, a component can also monitor system error messages.

Note
A monitor plug-in can monitor the RealServer registry for client connections and other conditions that are not errors. See "Appendix F: RealServer Property Registry".

Interfaces

A RealSystem component implements or uses the following error reporting interfaces:

Status Codes

The header file pnresult.h defines the status codes used in many RealSystem function calls as well as the system error messages. In normal operation, all RealSystem components need to be able to handle the following basic codes that may be returned by the RealSystem system:

See the pnresult.h file for the status codes that a RealSystem component may receive or return. A component can call IRMAErrorMessages::GetErrorText to get a text description of a status code. The method takes a status code as a parameter and returns a pointer to an IRMABuffer interface that contains the status code text.

Reporting Errors

Any RealSystem component can report an error to RealSystem (RealServer or client). RealServer logs errors in its system error log. RealSystem clients report errors in a pop-up dialog box but typically do not record error messages on the client computer or upload them to the system log. To report errors, a component calls IRMAErrorMessages::Report, which takes the following parameters:

Receiving Error Messages

A RealSystem component on RealServer or the client can receive notice of system errors by registering as an error sink:

  1. The component calls IRMAErrorSinkControl::AddErrorSink to register itself as an error sink. The method passes to the system context a pointer to the component as the IRMAErrorSink interface. It also passes two integer values, unLowSeverity and unHighSeverity, which have error severity levels as values. If, for example, the method call designates low as 0 and high as 2, the component receives messages only for errors of severity 0, 1, or 2.

  2. When an error that falls within the registered severity range occurs, RealServer or the client calls IRMAErrorSink::ErrorOccurred, passing the component the values for IRMAErrorMessages::Report described previously in the error reporting section.

  3. When the component does not need to receive error messages, it calls IRMAErrorSinkControl::RemoveErrorSink.

The sample logging plug-in /samples/intermed/exlogpln/exlogpln.cpp demonstrates how to get error messages using IRMAErrorSink and write them to a log file named exlog.log.

Additional Information
For details about creating plug-ins, such as error-logging plug-ins, see "Chapter 4: Development Framework".


Copyright © 2000 RealNetworks
For technical support, please contact supportsdk@real.com.
This file last updated on 05/17/00 at 12:50:22.
previous next