From c5080472d027fa37531860104d264ef89dcab165 Mon Sep 17 00:00:00 2001 From: holoncom Date: Tue, 26 Oct 2021 14:23:42 +0200 Subject: [PATCH] throw more helpful error when json Parse fails --- OpenContent/Components/OpenContentInfo.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/OpenContent/Components/OpenContentInfo.cs b/OpenContent/Components/OpenContentInfo.cs index 24f1c8cb..e5b6feba 100644 --- a/OpenContent/Components/OpenContentInfo.cs +++ b/OpenContent/Components/OpenContentInfo.cs @@ -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();