From: dog.ee.lbl.gov!overload.lbl.gov!agate!spool.mu.edu!darwin.sura.net!zaphod
Subject: Re: Exception'IMAGE in Ada9X?
Date: 2 Dec 92 04:08:42 GMT [thread overview]
Message-ID: <1992Dec1.230842.14135@sei.cmu.edu> (raw)
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
next reply other threads:[~1992-12-02 4:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1992-12-02 4:08 dog.ee.lbl.gov!overload.lbl.gov!agate!spool.mu.edu!darwin.sura.net!zaphod [this message]
-- strict thread matches above, loose matches on Subject: below --
1992-12-02 14:31 Exception'IMAGE in Ada9X? enterpoop.mit.edu!linus!linus.mitre.org!news!emery
1992-12-02 5:57 Kenneth Anderson
1992-12-02 3:42 Kenneth Anderson
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox