XlPrivateErrorHandling.mesa
Copyright Ó 1991, 1992, 1993 by Xerox Corporation. All rights reserved.
Christian Jacobi, November 6, 1991 9:57:47 am PST
Christian Jacobi, May 3, 1993 10:17 am PDT
Private interface which allows to customize handling of errors reported by an X server.
In general Xl allows to specify error handling on a per request basis. This module allows to specify what the default handling of error events should be if a request did NOT explicitely define error handling.
This module is private and at the level of XlImpl; no application specific clients please.
DIRECTORY Xl USING [Connection, ErrorNotifyEvent, EventRep, EventProcType, Match, SequenceNo];
XlPrivateErrorHandling: CEDAR DEFINITIONS =
BEGIN
Asynchronous errors
handling errors reported by the X server
RegisterErrorReportProc: PROC [proc: Xl.EventProcType];
Registers global error report procedure to report X errors back to the user or client.
This procedure is called when no connection specific error match has been set up.
ErrorReportProc: PROC [] RETURNS [Xl.EventProcType];
Returns global procedure used to report X errors.
Never returns NIL
RegisterErrorMatch: PROC [c: Xl.Connection, errorMatch: Xl.Match];
Registers match for asynchrounous X errors not otherwise caught for this connection.
This is for connection setup. It should NOT dynamically be changed like in Xlib, because this would interfere with asynchronous requestors.
Making errors human readable
ExplainerProc: TYPE = PROC [errorEvent: Xl.ErrorNotifyEvent];
RegisterExplainer: PROC [proc: ExplainerProc];
Registers procedure used to initialize explanation field
Explain: PROC [errorEvent: Xl.ErrorNotifyEvent];
Fills in explanation field by analyzing replyText, (if non NIL).
Clients might have to call Explain explicitely: it is sometimes not called internally because it is better called outside critical regions of XlImpl.
Once the explanation field is set, further calls to Explain are noops.
Generating errors
NewErrorEvent: PROC [reply: REF ANY, connection: Xl.Connection ¬ NIL, sequenceNumber: Xl.SequenceNo ¬ 0] RETURNS [REF Xl.EventRep.errorNotify];
Builds an error event from given reply structure. Fills in connection and sequenceNumber.
reply: NIL, or, correct type only. Ref any to prevent exposure of the definitions
Sets the server generated field to TRUE if reply#NIL
This is safe for use inside monitors, and, Explain is not yet called.
RaiseErrorEvent: PROC [errorEvent: Xl.ErrorNotifyEvent];
Raises an Xl.XError inline. Useful for implementing requests with replies.
RaiseClientError: PROC [c: Xl.Connection, what: REF ¬ NIL];
Builds an error event for clientError, and, raises it inline.
Client errors are raised to denote erronous call of an Xl funcion; raised without querrying the X server.
what: human readable in debugger
RaiseServerError: PROC [c: Xl.Connection, what: REF ¬ NIL, reply: REF ANY ¬ NIL];
Builds an error event for for blaming the X server, and, raises it inline.
Server errors are raised when Xl believes the X server is sending bogus data.
reply: NIL, or, correct type only. Ref any to prevent exposure of the definitions
what: human readable in debugger
RegisterRaiseErrorEvent: PROC [PROC [errorEvent: Xl.ErrorNotifyEvent]];
Registers a procedure to implement RaiseErrorEvent. This is not a client feature but a means enable debugging ugly recurring errors. Use NIL to reregister the default procedure.
END.