Skip to content

Commit

Permalink
Changed name of generator exception
Browse files Browse the repository at this point in the history
  • Loading branch information
ByronMayne committed Nov 12, 2023
1 parent 54e14bf commit b9baac4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Microsoft.CodeAnalysis;
using Serilog;
using Newtonsoft.Json;
using System;

namespace ConsoleApp.SourceGenerator
{
Expand Down Expand Up @@ -33,5 +34,11 @@ protected override void OnInitialize(SgfInitializationContext context)
Log.Information(JsonConvert.SerializeObject(payload));
Log.Information("Having the log makes working with generators much simpler!");
}

protected override void OnException(Exception exception)
{

base.OnException(exception);
}
}
}
4 changes: 2 additions & 2 deletions src/SourceGenerator.Foundations/IncrementalGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void IIncrementalGenerator.Initialize(IncrementalGeneratorInitializationContext
{
try
{
SgfInitializationContext sgfContext = new SgfInitializationContext(context, OnGenerateException);
SgfInitializationContext sgfContext = new SgfInitializationContext(context, OnException);

OnInitialize(sgfContext);
}
Expand All @@ -70,7 +70,7 @@ void IIncrementalGenerator.Initialize(IncrementalGeneratorInitializationContext
/// to handle the exception.
/// </summary>
/// <param name="exception">The exception that was thrown</param>
protected virtual void OnGenerateException(Exception exception)
protected virtual void OnException(Exception exception)
{
Logger.Error(exception, "Unhandled exception was throw while running the generator {Name}", Name);
}
Expand Down

0 comments on commit b9baac4

Please sign in to comment.