diff --git a/CHANGELOG.md b/CHANGELOG.md index ac3b4b8..a265a5f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +### Version: 1.0.7 +#### Date: January-12-2026 +- Improved error messages + ### Version: 1.0.6 #### Date: June-09-2025 - Used 'title' and 'target' in a tags diff --git a/Contentstack.Utils.Tests/DefaultRenderTest.cs b/Contentstack.Utils.Tests/DefaultRenderTest.cs index a13bd5b..6f44ee3 100644 --- a/Contentstack.Utils.Tests/DefaultRenderTest.cs +++ b/Contentstack.Utils.Tests/DefaultRenderTest.cs @@ -178,7 +178,11 @@ public void testLinkhDocument() string result = defaultRender.RenderNode("a", nodeLink, (nodes) => { return text; }); - Assert.Equal($"Text To set Link", result); + string url = nodeLink.attrs.ContainsKey("url") ? (string)nodeLink.attrs["url"] : ""; + string target = nodeLink.attrs.ContainsKey("target") ? (string)nodeLink.attrs["target"] : ""; + string title = nodeLink.attrs.ContainsKey("title") ? (string)nodeLink.attrs["title"] : ""; + + Assert.Equal($"Text To set Link", result); } [Fact] diff --git a/Contentstack.Utils.sln b/Contentstack.Utils.sln index 382b162..c0f18fa 100644 --- a/Contentstack.Utils.sln +++ b/Contentstack.Utils.sln @@ -21,7 +21,7 @@ Global {EB2B5E23-E45F-4C6C-BF98-FE3971DE4250}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(MonoDevelopProperties) = preSolution - version = 1.0.6 + version = 1.0.7 Policies = $0 $0.DotNetNamingPolicy = $1 $1.DirectoryNamespaceAssociation = PrefixedHierarchical diff --git a/Contentstack.Utils/Constants/ErrorMessages.cs b/Contentstack.Utils/Constants/ErrorMessages.cs new file mode 100644 index 0000000..6b1de14 --- /dev/null +++ b/Contentstack.Utils/Constants/ErrorMessages.cs @@ -0,0 +1,11 @@ +namespace Contentstack.Utils.Constants +{ + /// + /// Centralized error messages for the Contentstack Utils library + /// + public static class ErrorMessages + { + public const string InvalidRteJson = "Invalid RTE JSON. Provide a valid JSON structure and try again."; + } +} + diff --git a/Contentstack.Utils/Contentstack.Utils.csproj b/Contentstack.Utils/Contentstack.Utils.csproj index b01be4c..6eaeb87 100644 --- a/Contentstack.Utils/Contentstack.Utils.csproj +++ b/Contentstack.Utils/Contentstack.Utils.csproj @@ -36,6 +36,7 @@ + diff --git a/Contentstack.Utils/Converters/RTEJsonConverter.cs b/Contentstack.Utils/Converters/RTEJsonConverter.cs index 57323be..ecc198b 100644 --- a/Contentstack.Utils/Converters/RTEJsonConverter.cs +++ b/Contentstack.Utils/Converters/RTEJsonConverter.cs @@ -3,6 +3,7 @@ using System.Reflection; using Newtonsoft.Json; using Newtonsoft.Json.Linq; +using Contentstack.Utils.Constants; namespace Contentstack.Utils.Converters { @@ -10,7 +11,7 @@ public class RTEJsonConverter : JsonConverter { public override bool CanConvert(Type objectType) { - throw new NotImplementedException(); + throw new InvalidOperationException(ErrorMessages.InvalidRteJson); } public override object ReadJson(JsonReader reader, Type objectType, diff --git a/Directory.Build.props b/Directory.Build.props index 2a251d5..9a2bf6c 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,5 +1,5 @@ - 1.0.6 + 1.0.7 diff --git a/LICENSE b/LICENSE index 501f936..4382a0d 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright © 2012-2025 Contentstack. All Rights Reserved +Copyright © 2012-2026 Contentstack. All Rights Reserved Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal