aboutsummaryrefslogtreecommitdiff
path: root/src/Jellyfin.Drawing.Skia/SkiaCodecException.cs
diff options
context:
space:
mode:
authorBond-009 <bond.009@outlook.com>2023-01-11 09:22:35 +0100
committerGitHub <noreply@github.com>2023-01-11 09:22:35 +0100
commitaefa8da4ee2167e5ec63f27d83cd0ef41f01a8ae (patch)
tree6697e861af0f23ec0c0bb285b42e23ef61d3b57a /src/Jellyfin.Drawing.Skia/SkiaCodecException.cs
parent3ed0e70eaba16da29b212acc0d4f4ee50f15405b (diff)
parent16e33665a217cb6b37d88cca244eb1538d41b873 (diff)
Merge pull request #9064 from barronpm/move-jellyfin-drawing-skia
Diffstat (limited to 'src/Jellyfin.Drawing.Skia/SkiaCodecException.cs')
-rw-r--r--src/Jellyfin.Drawing.Skia/SkiaCodecException.cs45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/Jellyfin.Drawing.Skia/SkiaCodecException.cs b/src/Jellyfin.Drawing.Skia/SkiaCodecException.cs
new file mode 100644
index 000000000..9a50a4d62
--- /dev/null
+++ b/src/Jellyfin.Drawing.Skia/SkiaCodecException.cs
@@ -0,0 +1,45 @@
+using System.Globalization;
+using SkiaSharp;
+
+namespace Jellyfin.Drawing.Skia
+{
+ /// <summary>
+ /// Represents errors that occur during interaction with Skia codecs.
+ /// </summary>
+ public class SkiaCodecException : SkiaException
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="SkiaCodecException" /> class.
+ /// </summary>
+ /// <param name="result">The non-successful codec result returned by Skia.</param>
+ public SkiaCodecException(SKCodecResult result)
+ {
+ CodecResult = result;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="SkiaCodecException" /> class
+ /// with a specified error message.
+ /// </summary>
+ /// <param name="result">The non-successful codec result returned by Skia.</param>
+ /// <param name="message">The message that describes the error.</param>
+ public SkiaCodecException(SKCodecResult result, string message)
+ : base(message)
+ {
+ CodecResult = result;
+ }
+
+ /// <summary>
+ /// Gets the non-successful codec result returned by Skia.
+ /// </summary>
+ public SKCodecResult CodecResult { get; }
+
+ /// <inheritdoc />
+ public override string ToString()
+ => string.Format(
+ CultureInfo.InvariantCulture,
+ "Non-success codec result: {0}\n{1}",
+ CodecResult,
+ base.ToString());
+ }
+}