comp.lang.ada
 help / color / mirror / Atom feed
From: ucivax!gateway@ucbvax.Berkeley.EDU  (Kenneth Anderson)
Subject: Exception'IMAGE in Ada9X?
Date: 2 Dec 92 03:42:38 GMT	[thread overview]
Message-ID: <9212011938.aa08479@Paris.ics.uci.edu> (raw)

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;


Notes:  The above code does not imply that only buggy code should have
        exception handlers.

        I realize that I used 'IMAGE in the wrong fashion. I.E. Normally
        you would see something like T'IMAGE(Var_of_type_T). I just
        wanted to convey the notion of being able to print out what
        the exception is without coding a seperate when statement
        for all possible exceptions (including user defined exceptions).

Thanks in advance,

Ken Anderson

             reply	other threads:[~1992-12-02  3:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1992-12-02  3:42 Kenneth Anderson [this message]
  -- strict thread matches above, loose matches on Subject: below --
1992-12-02  4:08 Exception'IMAGE in Ada9X? dog.ee.lbl.gov!overload.lbl.gov!agate!spool.mu.edu!darwin.sura.net!zaphod
1992-12-02  5:57 Kenneth Anderson
1992-12-02 14:31 enterpoop.mit.edu!linus!linus.mitre.org!news!emery
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox