using System.Globalization;
using SkiaSharp;
namespace Jellyfin.Drawing.Skia
{
    /// 
    /// Represents errors that occur during interaction with Skia codecs.
    /// 
    public class SkiaCodecException : SkiaException
    {
        /// 
        /// Initializes a new instance of the  class.
        /// 
        /// The non-successful codec result returned by Skia.
        public SkiaCodecException(SKCodecResult result) : base()
        {
            CodecResult = result;
        }
        /// 
        /// Initializes a new instance of the  class
        /// with a specified error message.
        /// 
        /// The non-successful codec result returned by Skia.
        /// The message that describes the error.
        public SkiaCodecException(SKCodecResult result, string message)
            : base(message)
        {
            CodecResult = result;
        }
        /// 
        /// Gets the non-successful codec result returned by Skia.
        /// 
        public SKCodecResult CodecResult { get; }
        /// 
        public override string ToString()
            => string.Format(
                CultureInfo.InvariantCulture,
                "Non-success codec result: {0}\n{1}",
                CodecResult,
                base.ToString());
    }
}