package IO_EXCEPTIONS is STATUS_ERROR : exception; MODE_ERROR : exception; NAME_ERROR : exception; USE_ERROR : exception; DEVICE_ERROR : exception; END_ERROR : exception; DATA_ERROR : exception; LAYOUT_ERROR : exception; end IO_EXCEPTIONS; |
Note that it would be very inconvenient for these exceptions to be declared in each of the packages SEQUENTIAL_IO, DIRECT_IO, and TEXT_IO. Each instantiation of SEQUENTIAL_IO, for example, would then give rise to a different exception, and it would consequently be tedious to write a general purpose handler, since it would need to refer explicitly to all the instances.
For this reason the three packages all contain renaming declarations such as
STATUS_ERROR : exception renames IO_EXCEPTIONS.STATUS_ERROR;
This has the advantage that the user (and indeed the writer of the IO package bodies) need not refer explicitly to IO_EXCEPTIONS.