The OS procedures use the Modula-2+ exception mechanism to report abnormal conditions such as incorrect actual parameters and failure of underlying abstractions.
TYPE EC = (OkEC, BadExecutableEC, BadFileEC, BadFileNameEC, BadIOCtlOpEC, BadPIDEC, BadStateForSignalEC, CannotLinkToDirectoryEC, CannotWriteADirectoryEC, CrossDeviceLinkEC, DirectoryNotEmptyEC, DirectoryUnlinkEC, FileBusyEC, FileExistsEC, IOErrorEC, InvalidArgumentEC, InvalidCredentialsEC, InvalidObjectEC, LookUpEC, MinorDeviceDoesNotExistEC, NameTooLongEC, NoDriverForDeviceEC, NoMountedVolumesEC, NotADirectoryEC, NotATerminalEC, NotEnoughRoomEC, NotEnoughVMEC, NotImplementedEC, NotOwnerEC, NotSuperUserEC, NotTtyOwnerReadEC, NotTtyOwnerWriteEC, OperationConflictEC, PipeHasNoReaderEC, ProtectionViolationEC, PvOfflineEC, RanOutOfResourcesEC, RemoteFileEC, ServerNotAvailableEC, ShortExecutableEC, TooManyProcessesEC, TooManySymbolicLinksInPathEC, UnseekableObjectEC, VolumeNeedsCheckingEC, WouldBlockEC); EXCEPTION Error (EC);
A value of type EC is an error code used to describe one of many possible error conditions associated with the Error exception.
TYPE ES = SET OF EC; CONST FileFailureES = ES{IOErrorEC, PvOfflineEC, VolumeNeedsCheckingEC, RemoteFileEC}; FailureES = FileFailureES + ES{PipeHasNoReaderEC}; PathES = ES{BadFileNameEC, LookUpEC, NameTooLongEC, NoMountedVolumesEC, NotADirectoryEC, ProtectionViolationEC, ServerNotAvailableEC, TooManySymbolicLinksInPathEC} + FileFailureES;
Most error codes report an error on the part of the caller, i.e., an incorrect combination of parameters, or parameters that are not consistent with the internal state of the abstraction. In these cases, it is as if the procedure was never called. The error codes in the set FailureES report a problem that occurred at a lower level of abstraction. The error codes in the set FileFailureES errors are logged to the console device and may result in the file system having to be scavenged. Examples include the remote server going down, the disk drive being switched off line, etc.
The error codes raised by an individual procedure are documented by
listing them (individually, and FailureES and PathES where appropriate) in
a comment following the RAISES clause. If a particular error code has
special significance when raised by a particular procedure, it is
mentioned in the following text (using the shorthand `raises MumbleEC' to
stand for `raises Error(MumbleEC)'). Otherwise the standard descriptions
in Appendix B apply. The error codes in the set PathES report
errors encountered in translating a path name; see Appendix B,
page , for details.
VAR errMessage: ARRAY EC OF Text.T;
The errMessage variable maps each error code value into a descriptive
message suitable for logging or reporting to the user. (These messages
are similar to the descriptions in Appendix B, page
. They are constant and so do not include information
relevant to any particular occurrence of an error.)
EXCEPTION Alerted = Base.Alerted;
Alerted means that an alert was sent to the calling thread (usually by another client thread); it is only raised by procedures that can block indefinitely.