IPErrorsImpl.mesa
Errors and Signals known throughout the Interpress interpreter
Last edited by:
Doug Wyatt, July 7, 1983 11:44 am
DIRECTORY
IPErrors USING [AppearanceErrorType, AppearanceWarningType, Error, MasterErrorType, MasterWarningType],
Rope USING [Concat, ROPE];
IPErrorsImpl:
CEDAR
PROGRAM
IMPORTS Rope
EXPORTS IPErrors
= BEGIN OPEN IPErrors;
MasterError: PUBLIC ERROR[type: MasterErrorType] = CODE;
MasterWarning: PUBLIC SIGNAL[type: MasterWarningType] = CODE;
AppearanceError: PUBLIC SIGNAL[type: AppearanceErrorType] = CODE;
AppearanceWarning: PUBLIC SIGNAL[type: AppearanceWarningType] = CODE;
Bug: PUBLIC ERROR = CODE;
Name: TYPE = Rope.ROPE ← -- can't default
MENames: TYPE = ARRAY MasterErrorType OF Name;
MWNames: TYPE = ARRAY MasterWarningType OF Name;
AENames: TYPE = ARRAY AppearanceErrorType OF Name;
AWNames: TYPE = ARRAY AppearanceWarningType OF Name;
masterErrors:
REF MENames =
NEW[MENames ← [
BoundsFault: "bounds fault",
InvalidArgs: "invalid arguments",
LimitExceeded: "limit exceeded",
MalformedSkeleton: "malformed skeleton",
MarkMismatch: "mark mismatch",
MissingBody: "missing body",
NarrowFailed: "narrow failed",
StackOverflow: "stack overflow",
StackUnderflow: "stack underflow",
UndefinedProperty: "undefined property",
Unimplemented: "unimplemented",
WrongType: "wrong type"
]];
masterWarnings:
REF MWNames =
NEW[MWNames ← [
InvalidArgs: "invalid arguments",
NullValue: "null value",
Unimplemented: "unimplemented"
]];
appearanceErrors:
REF AENames =
NEW[AENames ← [
Unimplemented: "unimplemented"
]];
appearanceWarnings:
REF AWNames =
NEW[AWNames ← [
Unimplemented: "unimplemented"
]];
RopeFromError:
PUBLIC
PROC[error: Error]
RETURNS[Rope.
ROPE] = {
WITH error
SELECT
FROM
e: Error[Me] =>
RETURN[Rope.Concat["Master error: ", masterErrors[e.type]]];
e: Error[Mw] =>
RETURN[Rope.Concat["Master warning: ", masterWarnings[e.type]]];
e: Error[Ae] =>
RETURN[Rope.Concat["Appearance error: ", appearanceErrors[e.type]]];
e: Error[Aw] =>
RETURN[Rope.Concat["Appearance warning: ", appearanceWarnings[e.type]]];
ENDCASE => ERROR;
};
END.