comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <spam@spam.com>
Subject: Re: Error-names.
Date: Sun, 29 Feb 2004 19:03:26 GMT
Date: 2004-02-29T19:03:26+00:00	[thread overview]
Message-ID: <2Iq0c.15247$aT1.13123@newsread1.news.pas.earthlink.net> (raw)
In-Reply-To: <Gf60c.444$PR3.18471@attbi_s03>

tmoran@acm.org wrote:
> 
>   subtype Exception_Codes is Interfaces.C.Int range -10 .. 1;
> 
>   Coded_Exception_List : constant array(Exception_Codes)
>     := (Constraint_Error'Identity,
>         Program_Error'Identity,
>         Storage_Error'Identity,
>         Tasking_Error'Identity,
>         Ada.IO_Exceptions.Status_Error'Identity,
>         Ada.IO_Exceptions.Mode_Error'Identity,
>         Ada.IO_Exceptions.Name_Error'Identity,
>         ...
> 
>   function Error_Code_Of(E : Ada.Exceptions.Exception_Occurrence)
>   return Exception_Codes is
>     use Ada.Exceptions;
>   begin
>     for i in Coded_Exception_List'range loop
>       if Exception_Identity(E) = Coded_Exception_List(i) then
>         return i;
>       end if;
>     end loop;
>     raise; -- we have no code for this exception!  re-raise it
>   end Error_Code_Of;

This is pretty much what I would have suggested if Moran hadn't beat me 
to it. However, I think you can't use "raise" here without an exception 
name, since we're not necessarily in an exception handler. You could use 
Ada.Exceptions.Raise_Exception (E), but I suspect what is really wanted, 
based on the OP's earlier messages, is to return General_Error_Code.

-- 
Jeff Carter
"No one is to stone anyone until I blow this whistle,
do you understand? Even--and I want to make this
absolutely clear--even if they do say, 'Jehova.'"
Monty Python's Life of Brian
74




  parent reply	other threads:[~2004-02-29 19:03 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-28 12:58 Error-names Martin Klaiber
2004-02-28 13:35 ` Error-names Martin Dowie
2004-02-28 15:26   ` Error-names Martin Klaiber
2004-02-28 17:19     ` Error-names Marius Amado Alves
2004-02-28 18:31       ` Error-names Martin Klaiber
2004-02-28 19:47         ` Error-names tmoran
2004-02-28 20:29           ` Error-names Martin Klaiber
2004-02-29 19:03           ` Jeffrey Carter [this message]
2004-02-29 20:04             ` Error-names tmoran
2004-02-29 23:24               ` Error-names Björn Persson
2004-03-01 11:29                 ` Error-names Martin Klaiber
2004-03-01 12:48                   ` Error-names Marius Amado Alves
2004-03-02  2:15                     ` Error-names Jeffrey Carter
2004-02-29 20:33             ` Error-names Martin Klaiber
2004-02-29 23:43               ` Error-names tmoran
2004-03-01 11:20                 ` Error-names Martin Klaiber
2004-03-07 15:10                   ` Error-names Björn Persson
2004-03-08  5:42                   ` Error-names Dave Thompson
2004-02-28 20:26         ` Error-names Jacob Sparre Andersen
2004-02-28 18:29 ` Error-names Alexandre E. Kopilovitch
2004-02-29  5:30 ` Error-names David Marceau
2004-02-29 12:17   ` Error-names Martin Klaiber
2004-02-29 19:56     ` Error-names David Marceau
2004-02-29 21:57       ` Error-names Martin Klaiber
2004-03-01 23:20       ` Error-names Randy Brukardt
replies disabled

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