陈清红
2025-04-14 880f3c0257eeb8c37761d484258fdd102a369a19
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Quintiq file version 2.0
#parent: #root
Method DoTask (LibOpt_Task task) as stream[JSON]
{
  TextBody:
  [*
    result := stream[JSON]::Success();
    
    if( task.CanContinue() )
    {
      handle_exception := true;  
      breakpoint_stream := null( stream[Void] );
      if( this.HasBreakpoint( LibOpt_Component::ComponentPosition_Initialize(), task, breakpoint_stream ) )
      {
        result := breakpoint_stream->|this->DoOperation( task );
      }
      else
      {
        reactive_calls := LibOpt_CurrentTransaction::GetSpawnedReactiveCalls();
        result := this.DoOperation( task );
        handle_exception := reactive_calls <> LibOpt_CurrentTransaction::GetSpawnedReactiveCalls() and not task.Run().InOneTransaction();
      }
      
      if( handle_exception )
      {
        exception := task->HandleException( result->Exception() );
        
        result := stream[JSON]::Merge( exception->|stream[JSON]::Success(), result->IgnoreException() );
      }
    }
    return result;
  *]
}