Run method will not trigger WhenException.

Home Forums kbmMW Run method will not trigger WhenException.

Viewing 3 reply threads
  • Author
    Posts
    • #55189
      TomYU
      Participant

      hi,kim

      The following code will not trigger WhenException.

      procedure TForm4.Button1Click(Sender: TObject);
      begin
      Scheduler.Run([Task1,Task2])
      .WhenException(procedure(const AException:Exception)
      begin
      ShowMessage(AException.Message);
      end)
      .Activate;

      end;

      procedure TForm4.Task1(const AScheduledEvent: IkbmMWScheduledEvent);
      begin
      raise Exception.Create(‘Task1 Exception.’);
      end;

      procedure TForm4.Task2(const AScheduledEvent: IkbmMWScheduledEvent);
      begin
      raise Exception.Create(‘Task2 Exception.’);
      end;

      best regards

      Tom YU.

    • #55190
      TomYU
      Participant

      Code written like the following will not trigger WhenException.

      Scheduler.Run(Task1)
      .WhenException(procedure(const AException:Exception)
      begin
      ShowMessage(AException.Message);
      end)
      .Activate;

    • #55195
      kimbomadsen
      Keymaster

      WhenException for Run with multiple tasks will be fixed in next release.

      WhenException for Run with single task (no array of tasks) already works.

    • #55201
      TomYU
      Participant

      hi,kim

      5.13 fixed!

      thank you!

      best regards

      TomYU

Viewing 3 reply threads
  • You must be logged in to reply to this topic.