Skip to content

Commit

Permalink
fix(lib): Catch and log TypeScriptImportException and exit with 1
Browse files Browse the repository at this point in the history
  • Loading branch information
PerfectlyNormal committed Dec 5, 2023
1 parent 7185773 commit 7c5f3b9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [unreleased]

### Fixed

- Log an error and continue when we fail to convert a file

### Changed

- Enable Dependabot version updates
Expand Down
14 changes: 11 additions & 3 deletions TypeContractor/Contractor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,17 @@ public int Build(MetadataLoadContext? metadataLoadContext = null, bool smartClea
.ToList();

foreach (var type in outputTypes)
{
var filePath = writer.Write(type, outputTypes);
generatedFiles.Add(filePath);
{
try
{
var filePath = writer.Write(type, outputTypes);
generatedFiles.Add(filePath);
}
catch (TypeScriptImportException ex)
{
_configuration.Logger.LogError(ex, $"Unable to generate typings for {type.Name} ({type.FullName})");
returnCode = 1;
}
}
}

Expand Down

0 comments on commit 7c5f3b9

Please sign in to comment.