From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 2 Dec 92 04:08:42 GMT From: dog.ee.lbl.gov!overload.lbl.gov!agate!spool.mu.edu!darwin.sura.net!zaphod .mps.ohio-state.edu!cis.ohio-state.edu!news.sei.cmu.edu!ajpo.sei.cmu.edu!weller d@ucbvax.Berkeley.EDU (David Weller) Subject: Re: Exception'IMAGE in Ada9X? Message-ID: <1992Dec1.230842.14135@sei.cmu.edu> List-Id: In article <9212011938.aa08479@Paris.ics.uci.edu> kanderso@liege.ICS.UCI.EDU (K enneth Anderson) writes: >Hi, > >Does anyone know if they plan to have a feature in Ada9X that would get >rid of code that looks like this... > >procedure Buggy is >begin > ... >exception > when CONSTRAINT_ERROR => Text_IO.PUT_LINE("CONSTRAINT_ERROR in Buggy"); > when NUMERIC_ERROR => Text_IO.PUT_LINE("NUMERIC_ERROR in Buggy"); > when STORAGE_ERROR => Text_IO.PUT_LINE("STORAGE_ERROR in Buggy"); > when others => Text_IO.PUT_LINE("Fatal Error in Buggy"); >end Buggy; > >and replace it with something like > >procedure Buggy is >begin > ... >exception > when others => Text_IO.PUT_LINE(exception'IMAGE); >end Buggy; > Ask, and ye shall receive... Turning to my trusty 9X Mapping Rationale (4.1 for you other reviewers out there -- if my info is dated, please shout): the example actually goes like this: ... begin ... exception when E : others => -- Unhandled exception; log it Put(Log_File, "Unknown error in task Some_Task: " & System.Exception_Name(E) & System.Exception_Information(E)); ... -- Reset data structures as necesary. end; ... There's also talk of a third goodie, a type called Exception_Occurrence. This type can provide other useful tidbits like stack-traces. Pay careful attention to the different syntax in the "when" clause, cuz it ain't no typo! This gives us a variable name for our exception, which is used when we call Exception_Name. Hope this helped. dgw