Skip to content

Commit

Permalink
Merge #3347 Skip modules with parse errors in deserialization
Browse files Browse the repository at this point in the history
  • Loading branch information
DasSkelett committed Apr 15, 2021
2 parents 630439e + 73d3c6f commit 6b2340c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ All notable changes to this project will be documented in this file.
- [Core] Tell SharpZipLib to use Unicode when opening zips (#3345 by: DasSkelett; reviewed: HebaruSan)
- [GUI] Make incompatible mods warning dialog use newlines instead of commas (#3346 by: DeltaDizzy; reviewed: DasSkelett)
- [Core] Fix crash when overwriting manually installed files (#3349 by: HebaruSan; reviewed: DasSkelett)
- [Core] Skip modules with parse errors in deserialization (#3347 by: HebaruSan; reviewed: DasSkelett)

### Internal

Expand Down
9 changes: 9 additions & 0 deletions Core/Registry/AvailableModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using CKAN.Versioning;
using log4net;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace CKAN
{
Expand Down Expand Up @@ -51,6 +52,14 @@ public AvailableModule(string identifier)
internal SortedDictionary<ModuleVersion, CkanModule> module_version =
new SortedDictionary<ModuleVersion, CkanModule>();

[OnError]
private void OnError(StreamingContext context, ErrorContext errorContext)
{
log.WarnFormat("Discarding CkanModule, failed to parse {0}: {1}",
errorContext.Path, errorContext.Error.GetBaseException().Message);
errorContext.Handled = true;
}

/// <summary>
/// Record the given module version as being available.
/// </summary>
Expand Down

0 comments on commit 6b2340c

Please sign in to comment.