Class EgamiException
- Namespace
- Egami
- Assembly
- Egami.dll
The base class of every exception Egami throws for problems with image data or limits.
public abstract class EgamiException : Exception, ISerializable
- Inheritance
-
EgamiException
- Implements
- Derived
- Inherited Members
Examples
EgamiContext strict = EgamiContext.Default with
{
Limits = SafetyLimits.Default with { MaxPixels = 25_000_000, MaxTotalBytes = 256L * 1024 * 1024 },
};
try
{
// Read the header first: cheap, and it rejects what you do not want before any pixel memory is used.
RasterInfo info = Raster.Probe(upload, strict);
if (info.Width > 8000 || info.Height > 8000)
{
throw new InvalidDataException("Too large.");
}
using Raster image = Raster.Load(upload, strict, new ReaderOptions { Recovery = RecoveryMode.Strict });
Console.WriteLine($"{info.Format.Name} {image.Width} × {image.Height}");
}
catch (UnsupportedFormatException)
{
Console.WriteLine("Not an image format we accept.");
}
catch (LimitExceededException e)
{
Console.WriteLine($"Over the {e.LimitName} limit.");
}
catch (CorruptDataException e)
{
Console.WriteLine($"Damaged at byte {e.Offset}.");
}
Remarks
Mistakes in arguments throw the standard ArgumentException types instead.
Constructors
EgamiException(string, Exception?)
Initializes a new instance of the EgamiException class.
protected EgamiException(string message, Exception? innerException = null)