From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,98c463a9e98cfdf5 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-06-12 15:21:11 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeed.berkeley.edu!ucberkeley!intgwpad.nntp.telstra.net!news.telstra.net!news-server.bigpond.net.au!not-for-mail From: Dale Stanbrough Newsgroups: comp.lang.ada Subject: Re: Ada exceptions. unchecked? References: <8db3d6c8.0206112300.3965a62b@posting.google.com> <3D0750F1.7A12342@raytheon.com> <$4ctS45vG2pB@eisner.encompasserve.org> <3D0771D3.FFEA1AA4@san.rr.com> User-Agent: MT-NewsWatcher/3.2 (PPC Mac OS X) Message-ID: Date: Wed, 12 Jun 2002 22:21:10 GMT NNTP-Posting-Host: 144.132.91.90 X-Complaints-To: news@bigpond.net.au X-Trace: news-server.bigpond.net.au 1023920470 144.132.91.90 (Thu, 13 Jun 2002 08:21:10 EST) NNTP-Posting-Date: Thu, 13 Jun 2002 08:21:10 EST Organization: BigPond Internet Services (http://www.bigpond.net.au) Xref: archiver1.google.com comp.lang.ada:25833 Date: 2002-06-12T22:21:10+00:00 List-Id: Darren New wrote: > For a sloppy and imprecise example, > application's main calls file_open_dialog, > file_open_dialog calls gui_button_handler > gui_button_handler calls application's load_file > application's load_file calls Java's read, which throws EOF_error. > > At this point, the application's load_file has to get the error back to the > application's main routine to be handled. But the gui_button_handler doesn't > declare that it can throw EOF_error, because the button hasn't anything to > do with files. So the normal technique is to create a new unchecked > exception and pass the checked exception in the constructor, then throw > that, then catch it in the main routine and unwrap it. Note that this problem would also apply if exceptions had to be declared in a subprogram, and those subprograms were used in a generic. For example I have a convenience generic to iterate over each line of a file - you pass a procedure that does the work on each line. Clearly the generic can't know what exceptions the procedure could generate. Dale