Non-fatal exceptions
There are two types of exceptions, fatal and no-fatal.
Ordinal errors such as division-by-zero and overflow are fatal exceptions.
Non-fatal exceptions are raised by specific statements or functions such as INPUT, PRINT USING, USING$-functions, BREAK-statements.
A non-fatal exception can be raised only if it is contained in a when-body.
INPUT
An INPUT statement has the default recovery procedure. Ordinarily an INPUT statement itself manages insufficiency or excess of data or inconsistency of data type to request re-input.
However, when an INPUT statement is written in a when-body, insufficiency or excess of data or inconsistency of data type raises an exception, and then let the control branch to the exception handler.
Example.
10 WHEN EXCEPTION IN 20 INPUT A,B$ 30 USE 40 PRINT EXTYPE 50 END WHEN
The value of EXTYPE is as follows.
8102 syntactically incorrect input reply
8103 Non-numeric datum for a numeric variable.
8002 Too few data
8003 Too many data(or extra comma on the tail)
When an INPUT statement is written in a when-body, it is recommended to use a RERTY statement as follows.
100 WHEN EXCEPTION IN 110 INPUT A 120 USE 130 SELECT CASE EXTYPE 140 CASE 8102,8103,8002,8003 150 RETRY 160 CASE ELSE 170 ! Manages other exceptions 180 END SELECT 190 END WHEN
PRINT USING,USING$
When a PRINT USING statement or a USING$ function is written in a when-body, the following exceptions can be raised.
EXTYPE
8203 Format-item too short
8204 Exrad overflow
BREAK
If a BREAK is executed on a when-body, it merely raises an exception of extype 10007, and does not display the debug window. Therefore it is difficult to debug a when-body using a BREAK statement.
(However, using Break-Points on the debug window enables us to debug a when-body.)