admin
2025-01-22 7e31442f0e9b07764e9c6a9680d3d4aeba5fe1de
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Quintiq file version 2.0
#parent: #root
StaticMethod Read (const QuillError err, const LibOpt_Task task, output Boolean is_captured) as owning LibOpt_Error
{
  Description: 'Read the `QuillError` and if it is a captured one, read the original exception and set the `is_captured` to true.'
  TextBody:
  [*
    result := LibOpt_SnapshotError::Read( err );
    
    is_captured := LibOpt_SnapshotError::IsUserError( Translations::LibOpt_Optimization_CapturedException_Regex(), result );
    
    if( is_captured )
    {
      // Get the real error (not the "Captured Exception")
      json_string := '';
      if( LibOpt_Task::TryGetStoredString( task, LibOpt_Task::RollbackStorage_Error(), json_string ) )
      {
        result := guard( JSONIO::ImportFromString( json_string, typeof( LibOpt_Error ), "iso8601", "iso8601", "iso8601", 0 ).astype( LibOpt_Error ), & result );
      }
    }
    
    return & result;
  *]
}