comp.lang.ada
 help / color / mirror / Atom feed
From: Martin Klaiber <martinkl@zedat.fu-berlin.de>
Subject: Re: Error-names.
Date: Sat, 28 Feb 2004 16:26:50 +0100
Date: 2004-02-28T16:26:50+01:00	[thread overview]
Message-ID: <qio6h1-ns2.ln1@martinkl.dialup.fu-berlin.de> (raw)
In-Reply-To: c1q5et$sjq$1@sparta.btinternet.com

Martin Dowie <martin.dowie@btopenworld.com> wrote:

>> My problem now is that I also want to define return values for
>> exceptions like Constraint_Error.  But I can't define something like:

>>    Constraint_Error : C_Integer := -3;

> You could change all the names round e.g.

> Error_Constraint
> Error_Routine_Not_Defined.
> etc.

I was also thinking of that.  But the last one could be misunderstood
as: there is an error-routine not defined (IMHO).  Perhaps I rename the
'Constraint'-part instead and call the constant 'Range_Error' or so.

BTW: is there a way to handle all exceptions in one place?  I have many
functions (about 20 or more, they all set or get parameters) which all
need this exception-handling.  I was trying a solution like:

    function Handle_Exceptions return C_Integer is
    begin
       return 0;
    exception
       when Some_Exception => return Some_Exception_Error;
       when ...
       when ...
       when others => return General_Error;
    end Handle_Exceptions;
    
    function Set_Something return C_Integer is
    begin
       ... -- set the parameter
       return 0;
    exception
       when others => return Handle_Exceptions;
       raise;
    end Set_Something;

    and so on with all the other set- and get-functions.

But I get a warning that 'raise' is unreachable code and when I try it
out, it looks like the exception is really not re-raised.

Thx, Martin



  reply	other threads:[~2004-02-28 15:26 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   ` Martin Klaiber [this message]
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           ` Error-names Jeffrey Carter
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