ImageGear .NET - Updated
Handling Warnings and Errors
User Guide > How to Work with... > Handling Warnings and Errors

The common language runtime provides an exception handling model that is based on the representation of exceptions as objects.

ImageGear .NET natively supports the functionality of the new platform and reports errors by throwing an exception containing specific information about the error. It is important to note that not only ImageGear .NET exceptions can be thrown from its classes - system or currently executing application exceptions may be thrown as well.

ImageGear defines the ImGearException Class to represent errors during execution of its code. Although this class does not have a public constructor, the ThrowError member may be used to report a problem with an appropriate identifier listed in ImGearErrorCodes Enumeration.

The ImGearException Class is used to report critical errors (i.e., when incorrect parameters are specified or internal errors occur). However, to report minor and non-critical mistakes (i.e., an inconsistency of the metadata or image attributes in ImGearPage Class entered into the SavePage Method of the ImGearFileFormats Class), the toolkit uses yet another class a ImGearAddWarning Delegate. To use this functionality, the developer should register a defined delegate to receive information about errors at this level.