Skip to content

Commit

Permalink
Added some defensive code.
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardoeduardo committed Jun 27, 2019
1 parent e656aea commit 4609e0c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions TypeScript/src/Umbrella.TypeScript/TypeScriptGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,16 @@ public TypeScriptGenerator(params string[] onlyNamedAssemblies)
.AppendLine()
.AppendLine();

foreach (string message in exc.LoaderExceptions.Select(x => x.Message))
if (exc.LoaderExceptions?.Length > 0)
{
if (!string.IsNullOrWhiteSpace(message))
messageBuilder.AppendLine("\t - " + message);
foreach (string message in exc.LoaderExceptions.Select(x => x.Message))
{
if (!string.IsNullOrWhiteSpace(message))
messageBuilder.AppendLine("\t - " + message);
}
}

throw new UmbrellaTypeScriptException("There has been a problem loading the specified assemblies.", exc);
throw new UmbrellaTypeScriptException(messageBuilder.ToString(), exc);
}
catch (Exception exc)
{
Expand Down

0 comments on commit 4609e0c

Please sign in to comment.