File tree Expand file tree Collapse file tree 6 files changed +23
-5
lines changed
Engine/Executors/ModuleHandlers
test/ModularPipelines.UnitTests Expand file tree Collapse file tree 6 files changed +23
-5
lines changed Original file line number Diff line number Diff line change @@ -66,4 +66,5 @@ await PipelineHostBuilder.Create()
6666 . AddModule < UpdateReleaseNotesModule > ( ) ;
6767 }
6868 } )
69+ . ConfigurePipelineOptions ( ( context , options ) => options . DefaultRetryCount = 3 )
6970 . ExecutePipelineAsync ( ) ;
Original file line number Diff line number Diff line change 11* Chocolatey CLI helpers
2+ * Not in parallel attribute for running modules without parallelisation
23
34<!-- -->
45
5- * Not in parallel attribute for running modules without parallelisation
6+ * Better display of errored modules in the console output
Original file line number Diff line number Diff line change @@ -79,6 +79,8 @@ private async Task CancelPipelineAndThrow(Exception exception)
7979 await Task . Delay ( TimeSpan . FromMilliseconds ( 200 ) ) ;
8080
8181 ModuleResultTaskCompletionSource . TrySetException ( exception ) ;
82+
83+ Context . Logger . SetException ( exception ) ;
8284
8385 throw new ModuleFailedException ( Module , exception ) ;
8486 }
Original file line number Diff line number Diff line change 22
33namespace ModularPipelines . Logging ;
44
5- public interface IModuleLogger : ILogger , IDisposable , IConsoleWriter ;
5+ public interface IModuleLogger : ILogger , IDisposable , IConsoleWriter
6+ {
7+ internal void SetException ( Exception exception ) ;
8+ }
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ namespace ModularPipelines.Logging;
88internal abstract class ModuleLogger : IModuleLogger
99{
1010 protected static readonly object Lock = new ( ) ;
11+ protected Exception ? _exception ;
1112
1213 internal DateTime LastLogWritten { get ; set ; } = DateTime . MinValue ;
1314
@@ -20,6 +21,11 @@ internal abstract class ModuleLogger : IModuleLogger
2021 public abstract void Dispose ( ) ;
2122
2223 public abstract void LogToConsole ( string value ) ;
24+
25+ public void SetException ( Exception exception )
26+ {
27+ _exception = exception ;
28+ }
2329}
2430
2531internal class ModuleLogger < T > : ModuleLogger , IModuleLogger , ILogger < T >
@@ -203,6 +209,11 @@ private void TryObfuscateValues(object state)
203209
204210 private string GetCollapsibleSectionName ( )
205211 {
212+ if ( _exception != null )
213+ {
214+ return $ "{ typeof ( T ) . Name } - Error! { _exception . GetType ( ) . Name } ";
215+ }
216+
206217 return $ "{ typeof ( T ) . Name } ";
207218 }
208219
Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ public async Task NotInParallel()
7272 Assert . That (
7373 nextModule . StartTime . ToUnixTimeMilliseconds ( ) ,
7474 Is . EqualTo ( ( firstModule . StartTime + TimeSpan . FromSeconds ( 1 ) ) . ToUnixTimeMilliseconds ( ) )
75- . Within ( 150 )
75+ . Within ( 250 )
7676 ) ;
7777 }
7878
@@ -90,7 +90,7 @@ public async Task NotInParallel_With_ParallelDependency()
9090 Assert . That (
9191 nextModule . StartTime . ToUnixTimeMilliseconds ( ) ,
9292 Is . EqualTo ( ( firstModule . StartTime + TimeSpan . FromSeconds ( 1 ) ) . ToUnixTimeMilliseconds ( ) )
93- . Within ( 150 )
93+ . Within ( 250 )
9494 ) ;
9595 }
9696
@@ -109,7 +109,7 @@ public async Task NotInParallel_With_NonParallelDependency()
109109 Assert . That (
110110 nextModule . StartTime . ToUnixTimeMilliseconds ( ) ,
111111 Is . EqualTo ( ( firstModule . StartTime + TimeSpan . FromSeconds ( 2 ) ) . ToUnixTimeMilliseconds ( ) )
112- . Within ( 150 )
112+ . Within ( 250 )
113113 ) ;
114114 }
115115}
You can’t perform that action at this time.
0 commit comments