lazhen
2025-01-09 8afe90b633046db39042aada36b88193062f8cff
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
Quintiq file version 2.0
#parent: #root
Method HandleQuillError (LibOpt_Task task, QuillError e)
{
  Description:
  [*
    When an error happens in user code we catch it in the same transaction.
    
    We call this method with the `QuillError` we caught on the component that caused the error.
    By default we create an error snapshot in this method.
    
    Then we call this method again on all previous components that were executed in this transaction as well, except that the `QuillError` is a null instance.
    
    After calling these methods we always rollback the transaction. So the only thing you can do in this method is change the snapshot tree, as these will be preserved.
  *]
  TextBody:
  [*
    if( not isnull( task.SnapshotComponent() ) )
    {
      task.SnapshotComponent().Finalize();
    }
    
    is_captured := false;
    err := LibOpt_SnapshotError::Read( e, task, is_captured );
    if( not is_captured and not LibOpt_SnapshotError::IsUserError( Translations::LibOpt_Optimization_CapturedException_Regex(), err ) )
    {
      this.HandleException( err, task, false );
    }
  *]
}