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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1bbf6abea0b51e68 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-12 03:47:21 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!postnews1.google.com!not-for-mail From: antonis01@in.gr (Tony Danezis) Newsgroups: comp.lang.ada Subject: Re: Catching a DEVICE_ERROR? Date: 12 Jun 2003 03:47:21 -0700 Organization: http://groups.google.com/ Message-ID: <5771e505.0306120247.556a0aff@posting.google.com> References: <5771e505.0306110531.2df2d93a@posting.google.com> NNTP-Posting-Host: 62.103.170.220 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1055414841 11866 127.0.0.1 (12 Jun 2003 10:47:21 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 12 Jun 2003 10:47:21 GMT Xref: archiver1.google.com comp.lang.ada:39043 Date: 2003-06-12T10:47:21+00:00 List-Id: "David C. Hoos" wrote in message news:... > "Tony Danezis" wrote in message > news:5771e505.0306110531.2df2d93a@posting.google.com... > > Hello.. > > > > I am looking for assistance on how to catch a DEVICE_ERROR when > > printing to LPT1. My Code seems to be correct and I print fine when > > the printer (HP laserjet 1200)is ON, but the exception is not raised > > when the printer is unplugged or not powered on. > > (Using win 2000 and The GNAT Integrated Environment version 3.14a1) > > > > thanks for any insight and assistance > > Snippet of code follows: > > Why not make your exception handler like this: > > exception > when e: others => > Ada.Text_IO.Put_Line > (Ada.Text_IO.Standard_Error, > Ada.Exceptions.Exception_Information (e)); > end Printer_Test; > > Now, no matter what the exception, information about it will > be sent to the standard error file. > Thanks David for your suggestion...Your exception handler is a lot more elegant, however the error is NEVER raised. Its seems when printing to LPT1: and the printer is not present or powered on, no exception is caught and the program hangs.