chenqinghong
2024-05-07 3ec06a830367465068963156dcc1d8e522571c13
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
Quintiq file version 2.0
#parent: #root
Method HandleCreateRunError (LibOpt_Run previousLastRun, LibOpt_Optimizer optimizer, QuillError e)
{
  Description:
  [*
    This method handles errors that occur during the creation of a `LibOpt_Run`.
    A `LibOpt_Run` is passed in so that the `LibOpt_SnapshotError` can be added to the correct run.
    If a `LibOpt_Run` initializes, but fails to start this would be the newest run belonging to the optimizer.
    If the `LibOpt_Run` fails to initialize, a new run will be created and the error attached to that empty run.
  *]
  TextBody:
  [*
    // benlong Feb-11-2022 (created)
    currentLastRun := maxselect( optimizer, Run, r, true, r.RunNr() );
    if( isnull( currentLastRun )
        or currentLastRun = previousLastRun )
    {
      currentLastRun := LibOpt_Run::Create( optimizer );
    }
    currentLastRun.IsFailed( true );
    LibOpt_SnapshotError::Throw( currentLastRun, LibOpt_SnapshotError::Read( e ) );
    LibOpt_Component::WriteErrorToLog( e );
    currentLastRun.RollbackOneTransaction();
  *]
  InterfaceProperties { Accessibility: 'Module' }
}