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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,9d303864ae4c70ad X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-04-12 18:00:25 PST Path: archiver1.google.com!news1.google.com!news.glorb.com!news.cs.univ-paris8.fr!fr.ip.ndsoftware.net!proxad.net!usenet-fr.net!enst.fr!melchior!cuivre.fr.eu.org!melchior.frmug.org!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: exception parameters Date: 12 Apr 2004 20:58:51 -0400 Organization: Cuivre, Argent, Or Message-ID: References: <5ad0dd8a.0404090512.15af2908@posting.google.com> <5ad0dd8a.0404091828.6e79bb4e@posting.google.com> <5ad0dd8a.0404100735.7b2a8317@posting.google.com> NNTP-Posting-Host: lovelace.ada-france.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: melchior.cuivre.fr.eu.org 1081817940 10278 212.85.156.195 (13 Apr 2004 00:59:00 GMT) X-Complaints-To: usenet@melchior.cuivre.fr.eu.org NNTP-Posting-Date: Tue, 13 Apr 2004 00:59:00 +0000 (UTC) To: comp.lang.ada@ada-france.org Return-Path: In-Reply-To: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 X-Virus-Scanned: by amavisd-new-20030616-p7 (Debian) at ada-france.org X-BeenThere: comp.lang.ada@ada-france.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Gateway to the comp.lang.ada Usenet newsgroup" List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: archiver1.google.com comp.lang.ada:7025 Date: 2004-04-12T20:58:51-04:00 "Dmitry A. Kazakov" writes: > A database connection type may have a primitive operation Get_Last_Error. So > when you catch Database_Error and the connection object is still here (why > should it disappear?), you can get a detailed error description from it. > Get_Last_Error could be made task unique, if connection object will be used > concurrently. Yes, you _could_ do it that way. But embedding the information in the exception message is better; there are no global variables involved, so there are no tasking issues. It would be even better if you could embed a type other than string, but that's not as much gain. > > I understand there are lots of difficult implementation issues > > with general exception parameters, and it can certainly be carried > > too far. > > > > Ada allows one string parameter for exceptions. If it also allowed one > > integer parameter, that might be a nice compromise :). > > But the exception is already a sort of number. Why not to allow ranges? > > Connection_Lost_Error, SQL_Syntax_Error, Unknown_DB_Error : exception; > -- A consequent set of exceptions > Database_Error renames range Connection_Lost_Error..Unknown_DB_Error; > > or > > subtype Database_Error is range Connection_Lost_Error..Unknown_DB_Error; > -- A range of exceptions An actual 64 bit number encodes much more information. -- -- Stephe