comp.lang.ada
 help / color / mirror / Atom feed
From: ytomino <aghia05@gmail.com>
Subject: Re: Forcing Exception Handling
Date: Wed, 2 Mar 2011 05:39:07 -0800 (PST)
Date: 2011-03-02T05:39:07-08:00	[thread overview]
Message-ID: <bc560917-3969-4f44-b918-c9d6254c0ae0@i39g2000prd.googlegroups.com> (raw)
In-Reply-To: 02901b13-da72-48ae-9cb3-bf1a10144c44@u3g2000vbe.googlegroups.com

On Mar 1, 2:27 am, iloAda <egzgh...@gmail.com> wrote:
> Hello everybody,
>
> I was wondering if there is a way in Ada to force exception handling.
> For instance, if there is a call to a function that may raise an
> exception, force the caller to handle that exception.
> I was wondering if there is a compile time pragma that will isntruct
> the compiler to force the handling of exceptions!!
>
> Thanks guys
>
> Elie

I'm thinking exception-pass-by-argument style (?)

procedure Callee (Storage_Error : Exception_Id) is
begin
   ...
exception
   when Standard.Storage_Error => Raise_Exception (Storage_Error);
end Callee;

This function forces a caller to write the exception name explicitly.
A caller may become aware exception-handling,
and it able to classify same exception by local-exception, for
example:

Caller : declare
   Local1, Local2 : exception;
begin
   Callee (Local1'Identity); -- *1
   Callee (Local2'Identity); -- *2
exception
   when Local1 => ...; -- from *1
   when Local2 => ...; -- from *2
end Caller;



      parent reply	other threads:[~2011-03-02 13:39 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-28 17:27 Forcing Exception Handling iloAda
2011-02-28 17:32 ` Simon Clubley
2011-02-28 18:33   ` onox
2011-02-28 19:10     ` Simon Clubley
2011-02-28 18:34   ` Vinzent Hoefler
2011-02-28 20:20 ` Florian Weimer
2011-02-28 20:35 ` Ludovic Brenta
2011-03-01  3:54   ` Randy Brukardt
2011-03-01  8:34     ` Dmitry A. Kazakov
2011-03-02  0:00       ` Randy Brukardt
2011-03-02  8:28         ` Dmitry A. Kazakov
2011-02-28 20:38 ` Georg Bauhaus
2011-03-01  0:19   ` Shark8
2011-03-01  8:56     ` Dmitry A. Kazakov
2011-03-01  9:34       ` iloAda
2011-03-01  9:47         ` Vinzent Hoefler
2011-03-01  9:51         ` Dmitry A. Kazakov
2011-03-01 10:07           ` iloAda
2011-03-01 13:27         ` Mark Lorenzen
2011-03-01 16:11         ` J-P. Rosen
2011-03-02  0:11         ` Randy Brukardt
2011-03-01 15:23       ` Shark8
2011-03-01 15:44         ` Dmitry A. Kazakov
2011-03-02  0:02       ` Randy Brukardt
2011-03-01  2:08 ` Hoàng Đình Long
2011-03-02 13:39 ` ytomino [this message]
replies disabled

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