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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,5f260a1d9f0c280c X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!r66g2000hsg.googlegroups.com!not-for-mail From: Martin Newsgroups: comp.lang.ada Subject: Re: Common exception handling Date: Fri, 29 Aug 2008 01:32:18 -0700 (PDT) Organization: http://groups.google.com Message-ID: <2c0a5d86-82cf-4538-87d4-6733eaca8784@r66g2000hsg.googlegroups.com> References: <88961e92-80a8-4e96-b231-9d67eca0adf5@v26g2000prm.googlegroups.com> <1d1a76fa-a537-4994-9578-7c7604b26ca2@w24g2000prd.googlegroups.com> NNTP-Posting-Host: 20.133.0.8 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1219998738 6681 127.0.0.1 (29 Aug 2008 08:32:18 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 29 Aug 2008 08:32:18 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: r66g2000hsg.googlegroups.com; posting-host=20.133.0.8; posting-account=g4n69woAAACHKbpceNrvOhHWViIbdQ9G User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:1818 Date: 2008-08-29T01:32:18-07:00 List-Id: On 26 Aug, 15:43, Adam Beneschan wrote: > On Aug 26, 6:47 am, shaunpatter...@gmail.com wrote: > > > Yeah, it looks like the extra layer of exception handling is the only > > way. I was hoping I could avoid that if possible. > > No, I don't think it's the only way. =A0I'm surprised no one has > suggested this: > > =A0 =A0exception > =A0 =A0 =A0 when E : others =3D> > =A0 =A0 =A0 =A0 =A0Print_Test (Rec); > =A0 =A0 =A0 =A0 =A0declare > =A0 =A0 =A0 =A0 =A0 =A0 =A0use Ada.Exceptions; > =A0 =A0 =A0 =A0 =A0begin > =A0 =A0 =A0 =A0 =A0 =A0 =A0if Exception_Identity(E) =3D A'Identity then > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ... handling for A > =A0 =A0 =A0 =A0 =A0 =A0 =A0elsif Exception_Identity(E) =3D B'Identity the= n > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ... handling for B > =A0 =A0 =A0 =A0 =A0 =A0 =A0etc. > =A0 =A0 =A0 =A0 =A0 =A0 =A0else > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ... handling for other exceptions you did= n't expect, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ... but you certainly need to aware that = it could > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ... happen > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 raise; =A0--maybe > =A0 =A0 =A0 =A0 =A0 =A0 =A0end if; > =A0 =A0 =A0 =A0 =A0end; > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 -- Adam Surely you missed a smiley off this suggestion!!! :-) =3D=3D Martin