File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
scalardb-dotnet-samples/scalardb-cluster-sample/Commands Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 11using System . CommandLine ;
2+ using System . Diagnostics ;
23using ScalarDB . Client . Exceptions ;
34
45namespace ScalarDbClusterSample . Commands ;
@@ -16,6 +17,7 @@ public static Command Create()
1617 using var sample = new Sample ( ) ;
1718 await sample . CreateTables ( ) ;
1819
20+ TransactionException ? lastException = null ;
1921 var attempts = 10 ;
2022 while ( attempts -- > 0 )
2123 {
@@ -24,17 +26,20 @@ public static Command Create()
2426 await sample . LoadInitialData ( ) ;
2527 return ;
2628 }
27- catch ( IllegalArgumentException )
29+ catch ( IllegalArgumentException ex )
2830 {
2931 // there's can be a lag until ScalarDB Cluster recognize namespaces and tables created
3032 // in some databases like Cassandra, so if this command was called for the first time
3133 // the first attempts can fail with 'The namespace does not exist' error
32-
34+ lastException = ex ;
3335 await Task . Delay ( TimeSpan . FromSeconds ( 1 ) ) ;
3436 }
3537 }
38+
39+ Debug . Assert ( lastException != null ) ;
40+ throw lastException ;
3641 } ) ;
37-
42+
3843 return loadInitialDataCommand ;
3944 }
4045}
You can’t perform that action at this time.
0 commit comments