title: Can't handle exceptions in ada tasks
body: <p>I have the following example:</p>
  
  <pre><code>with Ada.TEXT_IO;
  use Ada.TEXT_IO;
  
  procedure main is
  
    task Test is
      entry Call1;
      entry Call2;
    end Test;
  
    task body Test is
      Num : Integer := 5;
    begin
      loop
        select when Num &lt; 5 =&gt;
          accept Call1 do
            Put_Line("Call1 called!");
          end Call1;
        or when Num &gt; 5 =&gt;
          accept Call2 do
            Put_Line("Call2 called!");
          end Call2;
        or
          terminate;
        end select;
      end loop;
      exception when PROGRAM_ERROR =&gt; Put_Line("Nothing to call... :(");
    end Test;
  
  begin
    Test.Call1;
  end;
  </code></pre>
  
  <p>If I'm right, the task gets program_error when it can't call anything. When I run it, it stuck in an endless while loop. How can I solve the problem?</p>