namespace AyCode.Core.Serializers.Jsons;

/// <summary>
/// Exception thrown when JSON deserialization fails.
/// </summary>
public class AcJsonDeserializationException : Exception
{
    public string? Json { get; }
    public Type? TargetType { get; }

    public AcJsonDeserializationException(string message, string? json = null, Type? targetType = null, Exception? innerException = null)
        : base(message, innerException)
    {
        Json = json?.Length > 500 ? json[..500] + "..." : json;
        TargetType = targetType;
    }
}