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,699cc914522aa7c4 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!newsfeed2.dallas1.level3.net!news.level3.com!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Structured exception information Date: Mon, 15 Jan 2007 18:22:23 -0500 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <1168900961.743193.85000@v45g2000cwv.googlegroups.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls6.std.com 1168903345 16892 192.74.137.71 (15 Jan 2007 23:22:25 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Mon, 15 Jan 2007 23:22:25 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:jP8wuk/yiQIQVg1LEDLP9dB3jj8= Xref: g2news2.google.com comp.lang.ada:8147 Date: 2007-01-15T18:22:23-05:00 List-Id: "Adam Beneschan" writes: > procedure My_Own_Raise (E : in Ada.Exceptions.Exception_ID; > Info : Extra_Info; > Message : in String := ""); > > The implementation of this routine would call > Ada.Exceptions.Raise_Exception(E,Message), and at the same time attach > "Info" to the exception occurrence, so that another routine in this > package could retrieve the information from the exception occurrence. > (Is this the sort of design you had in mind?) You could have: procedure My_Own_Raise (E : in Ada.Exceptions.Exception_ID; Info : Extra_Info); and the implementation could encode Info as a String, and use that as the Message passed to Raise_Excpetion. The handler then decodes the String. The stream attributes could be used for encoding/decoding. Maybe wrapping this mess in some generics could make it more type safe. Yuck. - Bob