From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,1a4156f047b063f X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!i39g2000prd.googlegroups.com!not-for-mail From: ytomino Newsgroups: comp.lang.ada Subject: Re: Forcing Exception Handling Date: Wed, 2 Mar 2011 05:39:07 -0800 (PST) Organization: http://groups.google.com Message-ID: References: <02901b13-da72-48ae-9cb3-bf1a10144c44@u3g2000vbe.googlegroups.com> NNTP-Posting-Host: 118.15.185.151 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1299073147 27805 127.0.0.1 (2 Mar 2011 13:39:07 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 2 Mar 2011 13:39:07 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: i39g2000prd.googlegroups.com; posting-host=118.15.185.151; posting-account=Mi71UQoAAACnFhXo1NVxPlurinchtkIj User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.102 Safari/534.13,gzip(gfe) Xref: g2news2.google.com comp.lang.ada:18691 Date: 2011-03-02T05:39:07-08:00 List-Id: On Mar 1, 2:27=A0am, iloAda 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 =3D> 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 =3D> ...; -- from *1 when Local2 =3D> ...; -- from *2 end Caller;