Skip to content

Commit

Permalink
Add try catch and needed logging for a actionable message to the user. (
Browse files Browse the repository at this point in the history
#8131)

* Add try catch and needed logging

* missing import

Co-authored-by: Sai Pramod Upadhyayula <saupa@microsoft.com>
  • Loading branch information
saipramod and Sai Pramod Upadhyayula committed Aug 17, 2022
1 parent d111647 commit 353f5c3
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Microsoft.DocAsCode.Build.Engine/CompilePhaseHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace Microsoft.DocAsCode.Build.Engine
{
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.IO;
Expand Down Expand Up @@ -140,7 +141,15 @@ private static void BuildArticle(HostService hostService, int maxParallelism)
Logger.LogDiagnostic($"Processor {hostService.Processor.Name}, step {buildStep.Name}: Building...");
using (new LoggerPhaseScope(buildStep.Name, LogLevel.Diagnostic, aggregatedPerformanceScope))
{
buildStep.Build(m, hostService);
try
{
buildStep.Build(m, hostService);
}
catch (Exception ex)
{
Logger.LogError($"Trouble processing file - {m.FileAndType.FullPath}, with error - {ex.Message}");
throw;
}
}
});
}
Expand Down

0 comments on commit 353f5c3

Please sign in to comment.