Skip to content

Commit

Permalink
Improve logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Ganss committed Mar 26, 2019
1 parent 04901f7 commit a01f5bd
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion XmlSchemaClassGenerator/Generator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,15 @@ public void Generate(IEnumerable<string> files)
var readers = files.Select(f => XmlReader.Create(f, settings));

set.XmlResolver = new XmlUrlResolver();
set.ValidationEventHandler += (s, e) => Trace.TraceError(e.Message);
set.ValidationEventHandler += (s, e) =>
{
var ex = e.Exception as Exception;
while (ex != null)
{
Log?.Invoke(ex.Message);
ex = ex.InnerException;
}
};

foreach (var reader in readers)
set.Add(null, reader);
Expand Down

0 comments on commit a01f5bd

Please sign in to comment.