| 1 |
(* Library module defined by the International Standard |
| 2 |
Information technology - programming languages |
| 3 |
BS ISO/IEC 10514-1:1996E Part 1: Modula-2, Base Language. |
| 4 |
|
| 5 |
Copyright ISO/IEC (International Organization for Standardization |
| 6 |
and International Electrotechnical Commission) 1996-2021. |
| 7 |
|
| 8 |
It may be freely copied for the purpose of implementation (see page |
| 9 |
707 of the Information technology - Programming languages Part 1: |
| 10 |
Modula-2, Base Language. BS ISO/IEC 10514-1:1996). *) |
| 11 |
|
| 12 |
DEFINITION MODULE GeneralUserExceptions; |
| 13 |
|
| 14 |
(* Provides facilities for general user-defined exceptions *) |
| 15 |
|
| 16 |
TYPE |
| 17 |
GeneralExceptions = (problem, disaster); |
| 18 |
|
| 19 |
PROCEDURE RaiseGeneralException (exception: GeneralExceptions; |
| 20 |
text: ARRAY OF CHAR); |
| 21 |
(* Raises exception using text as the associated message *) |
| 22 |
|
| 23 |
PROCEDURE IsGeneralException (): BOOLEAN; |
| 24 |
(* Returns TRUE if the current coroutine is in the exceptional |
| 25 |
execution state because of the raising of an exception from |
| 26 |
GeneralExceptions; otherwise returns FALSE. |
| 27 |
*) |
| 28 |
|
| 29 |
PROCEDURE GeneralException(): GeneralExceptions; |
| 30 |
(* If the current coroutine is in the exceptional execution |
| 31 |
state because of the raising of an exception from |
| 32 |
GeneralExceptions, returns the corresponding enumeration value, |
| 33 |
and otherwise raises an exception. |
| 34 |
*) |
| 35 |
|
| 36 |
END GeneralUserExceptions. |