comp.lang.ada
 help / color / mirror / Atom feed
From: "Björn Lundin" <b.f.lundin@gmail.com>
Subject: Re: Error "exception not permitted here" when putting EXCEPTION in a loop
Date: Fri, 17 Jul 2015 18:02:39 +0200
Date: 2015-07-17T18:02:39+02:00	[thread overview]
Message-ID: <mob8pu$kga$1@dont-email.me> (raw)
In-Reply-To: <db4edc22-34ef-4f09-b2b4-65f7ba00540b@googlegroups.com>

On 2015-07-17 17:47, Trish Cayetano wrote:
> Hi, 
> 
> I am getting error "exception not permitted here" when running below in a loop. 
> Well it runs if I put it outside the loop but I need it inside the loop... 
> 
>            exception
>             when ADA.IO_EXCEPTIONS.DATA_ERROR =>
>             Ada.Text_IO.Put_Line ("Try a number from 1 to 4, Buddy");
> 
> Thanks in advance for your help...
> 

-- basic procedure
procedure bla is
begin
  null;
exception
  when Constraint_error => null;
end bla;



procedure bla is
begin

  -- catch 1 exception and then fall out of loop
  begin
    loop
      do_stuff;
    end loop;
  exception
    when Constraint_error => null;
  end;

-- or perhaps

  -- catch exception outside every invocation of do_stuff
  -- not falling out of loop
  loop
    begin
      do_stuff;
    exception
      when Constraint_error => null;
    end;
  end loop;


exception
  when Constraint_error => null;
end bla;




-- 
--
Björn


      parent reply	other threads:[~2015-07-17 16:02 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-17 15:47 Error "exception not permitted here" when putting EXCEPTION in a loop Trish Cayetano
2015-07-17 15:56 ` David Botton
2015-07-17 15:58 ` G.B.
2015-07-18  8:14   ` Trish Cayetano
2015-07-18 10:08     ` Björn Lundin
2015-07-18 12:41       ` Trish Cayetano
2015-07-18 13:56         ` Björn Lundin
2015-07-18 14:08           ` Niklas Holsti
2015-07-18 14:56             ` Björn Lundin
2015-07-18 14:32           ` Trish Cayetano
2015-07-18 14:59             ` Björn Lundin
2015-07-18 16:09             ` Dennis Lee Bieber
2015-07-18 18:11               ` Niklas Holsti
2015-07-18 21:16                 ` Dennis Lee Bieber
2015-07-17 16:02 ` Björn Lundin [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox