DIRECTORY PreDebug, Rope, Xl, XlPrivate, XlPrivateErrorHandling, XlTQPrivate; XlPrivateErrorHandlingImpl: CEDAR MONITOR IMPORTS PreDebug, Rope, Xl, XlPrivate, XlTQPrivate EXPORTS Xl, XlPrivateErrorHandling ~ BEGIN XError: PUBLIC <> SIGNAL [err: Xl.ErrorNotifyEvent] ~ CODE; connectionNotCreated: PUBLIC <> SIGNAL [why: REF Xl.ConnectionRejectInfo] ~ CODE; reportProc: Xl.EventProcType ¬ DefaultErrorEventProc; explainerProc: XlPrivateErrorHandling.ExplainerProc ¬ DefaultExplain; RegisterErrorReportProc: PUBLIC PROC [proc: Xl.EventProcType] = { IF proc#NIL THEN reportProc ¬ proc }; RegisterExplainer: PUBLIC PROC [proc: XlPrivateErrorHandling.ExplainerProc] = { IF proc#NIL THEN explainerProc ¬ proc }; ErrorReportProc: PUBLIC PROC [] RETURNS [Xl.EventProcType] = { RETURN [reportProc]; }; Explain: PUBLIC PROC [errorEvent: Xl.ErrorNotifyEvent] = { IF errorEvent.explanation=NIL THEN explainerProc[errorEvent]; }; DefaultErrorEventProc: Xl.EventProcType = { WITH event SELECT FROM error: Xl.ErrorNotifyEvent => { Explain[error]; BEGIN ENABLE ABORTED => { XlTQPrivate.RemoveErrorEvents[tq]; GOTO oops }; SIGNAL Xl.XError[error]; EXITS oops => {}; END; }; ENDCASE => ERROR; }; DefaultExplain: PROC [errorEvent: Xl.ErrorNotifyEvent] = { }; NewErrorEvent: PUBLIC PROC [reply: REF ANY, connection: Xl.Connection ¬ NIL, sequenceNumber: Xl.SequenceNo ¬ 0] RETURNS [err: REF Xl.EventRep.errorNotify] = { rep: XlPrivate.Reply ¬ NARROW[reply]; err ¬ NEW[Xl.EventRep.errorNotify]; err.replyText ¬ rep; err.connection ¬ connection; err.seq ¬ sequenceNumber; IF rep=NIL THEN err.errorKind ¬ clientError ELSE { err.serverGenerated ¬ TRUE; err.originalCodeByte ¬ XlPrivate.Get8[rep, 0]; IF err.originalCodeByte<=ORD[Xl.ErrorKind[implementation]] THEN err.errorKind ¬ VAL[err.originalCodeByte] ELSE err.errorKind ¬ otherServer; }; }; errorEventRaiser: PROC [errorEvent: Xl.ErrorNotifyEvent] ¬ DefaultRaiseErrorEvent; RaiseErrorEvent: PUBLIC PROC [errorEvent: Xl.ErrorNotifyEvent] = { IF errorEvent#NIL THEN { c: Xl.Connection ¬ errorEvent.connection; Explain[errorEvent]; IF c#NIL THEN c.lastError ¬ errorEvent; errorEventRaiser[errorEvent]; } }; DefaultRaiseErrorEvent: PROC [errorEvent: Xl.ErrorNotifyEvent] = { ERROR Xl.XError[errorEvent]; }; RegisterRaiseErrorEvent: PUBLIC PROC [p: PROC [errorEvent: Xl.ErrorNotifyEvent]] = { IF p=NIL THEN p ¬ DefaultRaiseErrorEvent; errorEventRaiser ¬ p }; RegisterErrorMatch: PUBLIC PROC [c: Xl.Connection, errorMatch: Xl.Match] = { IF errorMatch=NIL THEN errorMatch ¬ NEW[Xl.MatchRep] ELSE {m: Xl.Match ¬ NEW[Xl.MatchRep ¬ errorMatch­]; errorMatch ¬ m}; IF errorMatch.tq=NIL THEN errorMatch.tq ¬ Xl.CreateTQ[]; IF errorMatch.proc=NIL THEN errorMatch.proc ¬ ErrorReportProc[]; IF errorMatch.handles=NIL THEN errorMatch.handles ¬ NEW[Xl.EventFilterRec]; c.errorMatch ¬ errorMatch; }; ExplainXError: PreDebug.Explainer = { msg ¬ "Xl.XError"; IF args=NIL THEN RETURN; PreDebug.Raise[signalOrError, args ! XError => { IF err.explanation=NIL THEN Explain[err]; IF ~Rope.IsEmpty[err.explanation] THEN msg ¬ Rope.Cat[msg, " ", err.explanation]; CONTINUE }]; }; ExplainConnectionNotCreated: PreDebug.Explainer = { msg ¬ "Xl.connectionNotCreated"; IF args=NIL THEN RETURN; PreDebug.Raise[signalOrError, args ! connectionNotCreated => { IF ~Rope.IsEmpty[why.reason] THEN msg ¬ Rope.Cat[msg, " ", why.reason]; CONTINUE }]; }; RaiseClientError: PUBLIC PROC [c: Xl.Connection, what: REF ¬ NIL] = { err: REF Xl.EventRep.errorNotify ~ NewErrorEvent[reply: NIL, connection: c]; err.serverGenerated ¬ FALSE; err.internal ¬ what; err.errorKind ¬ clientError; RaiseErrorEvent[err]; ERROR; }; RaiseServerError: PUBLIC PROC [c: Xl.Connection, what: REF ¬ NIL, reply: REF ANY ¬ NIL] = { err: REF Xl.EventRep.errorNotify ~ NewErrorEvent[reply: reply, connection: c]; err.serverGenerated ¬ FALSE; err.internal ¬ what; err.errorKind ¬ VAL[241]; --overwrites field set using reply RaiseErrorEvent[err]; ERROR; }; PreDebug.RegisterSignalExplainer[connectionNotCreated, ExplainConnectionNotCreated]; PreDebug.RegisterSignalExplainer[XError, ExplainXError]; END. *XlPrivateErrorHandlingImpl.mesa Copyright Σ 1991, 1992, 1993 by Xerox Corporation. All rights reserved. Created by Christian Jacobi, November 6, 1991 10:11:20 am PST Christian Jacobi, May 3, 1993 10:35 am PDT --Proceeding gets to the next queued error, --Aborting flushes the error queue. Κ~•NewlineDelimiter –(cedarcode) style˜codešœ™Kšœ Οeœ=™HKšœ=™=K™*K™—šΟk œ˜ KšœC˜CK˜—šΟnœžœžœ˜*Kšžœ,˜3Kšžœ˜$—Kšžœ˜K˜KšŸœžœžœžœ˜?Kš œžœžœžœžœ˜UK˜K˜5K˜EK˜šŸœžœžœ˜AKšžœžœžœ˜"K˜K˜—šŸœžœžœ1˜OKšžœžœžœ˜%K˜K˜—šŸœž œžœ˜>Kšžœ˜K˜K˜—šŸœžœžœ&˜:Kšžœžœžœ˜=Kšœ˜—K˜šŸœ˜+šžœžœž˜šœ ˜ Kšœ˜šž˜šžœžœ˜Kšœ#žœ˜,Kšœ˜—Kšžœ˜KšΟcΡbcn   ™,Kšœ‘ ™#Kšžœ ˜Kšžœ˜—K˜—Kšžœžœ˜—Kšœ˜—K˜šŸœžœ&˜:K˜—K˜šŸ œžœžœ žœžœžœ%žœžœ˜žKšœžœ˜%Kšœžœ˜#Kšœ˜Kšœ˜Kšœ˜šžœžœ˜ Kšžœ˜ šžœ˜Kšœžœ˜Kšœ.˜.šžœžœ˜;Kšžœžœ˜.Kšžœ˜!—K˜——K˜K˜—Kšœžœ<˜RK˜šŸœžœžœ&˜Bšžœ žœžœ˜K˜)Kšœ˜Kšžœžœžœ˜'K˜K˜—K˜K˜—šŸœžœ&˜BKšžœ˜K˜K˜—šŸœžœžœžœ'˜TJšžœžœžœ˜*J˜K˜K˜—šŸœžœžœ-˜Lšžœ žœ˜Kšžœžœ˜#Kšžœžœ-˜D—Kšžœžœžœ˜8Kšžœžœžœ%˜@Kšžœžœžœžœ˜KKšœ˜K˜—K˜šŸ œ˜%K˜Kšžœžœžœžœ˜šœ0˜0Kšžœžœžœ˜)Kšžœ žœ+˜QKšž˜K˜—K˜—K˜šŸœ˜3Kšœ ˜ Kšžœžœžœžœ˜šœ>˜>Kšžœžœ&˜GKšž˜K˜—K˜K˜—šŸœž œžœžœ˜EKšœžœ0žœ˜LKšœžœ˜K˜K˜Kšœ˜Kšžœ˜Kšœ˜K˜—šŸœžœžœžœžœ žœžœžœ˜[KšœžœF˜NKšœžœ˜K˜Kšœ "˜