Skip to content

Commit

Permalink
throw more helpful error when json Parse fails
Browse files Browse the repository at this point in the history
  • Loading branch information
robsiera committed Oct 26, 2021
1 parent dec7e9f commit c508047
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion OpenContent/Components/OpenContentInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,14 @@ public JToken JsonAsJToken
{
if (_jsonAsJToken == null && !string.IsNullOrEmpty(this.Json))
{
_jsonAsJToken = JToken.Parse(this.Json);
try
{
_jsonAsJToken = JToken.Parse(this.Json);
}
catch (Exception e)
{
throw new Exception($"Failed to parse json from moduleId:{ModuleId}, contentId:{ContentId}", e);
}
}
// JsonAsJToken is modified (to remove other cultures)
return _jsonAsJToken?.DeepClone();
Expand Down

0 comments on commit c508047

Please sign in to comment.