Skip to content

Commit 99260e1

Browse files
committed
Centralize error messages in Constants/ErrorMessages.cs
- Created new ErrorMessages.cs constants file for centralized error message management - Updated RTEJsonConverter.cs to use error message constant instead of hardcoded string - Added Constants folder to project file - Improves maintainability by keeping all error messages in one location
1 parent ab0d6ce commit 99260e1

3 files changed

Lines changed: 14 additions & 1 deletion

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
namespace Contentstack.Utils.Constants
2+
{
3+
/// <summary>
4+
/// Centralized error messages for the Contentstack Utils library
5+
/// </summary>
6+
public static class ErrorMessages
7+
{
8+
public const string InvalidRteJson = "Invalid RTE JSON. Provide a valid JSON structure and try again.";
9+
}
10+
}
11+

Contentstack.Utils/Contentstack.Utils.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
<Folder Include="Enums\" />
3737
<Folder Include="Extensions\" />
3838
<Folder Include="Converters\" />
39+
<Folder Include="Constants\" />
3940
</ItemGroup>
4041
<ItemGroup>
4142
<PackageReference Include="HtmlAgilityPack" Version="1.11.46" />

Contentstack.Utils/Converters/RTEJsonConverter.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
using System.Reflection;
44
using Newtonsoft.Json;
55
using Newtonsoft.Json.Linq;
6+
using Contentstack.Utils.Constants;
67

78
namespace Contentstack.Utils.Converters
89
{
910
public class RTEJsonConverter : JsonConverter
1011
{
1112
public override bool CanConvert(Type objectType)
1213
{
13-
throw new NotImplementedException();
14+
throw new InvalidOperationException(ErrorMessages.InvalidRteJson);
1415
}
1516

1617
public override object ReadJson(JsonReader reader, Type objectType,

0 commit comments

Comments
 (0)