ImageMagick.MagickExceptionHelper.Create C# (CSharp) Method

Create() private method

private Create ( ExceptionSeverity severity, string message, MagickException innerExceptions ) : MagickException
severity ExceptionSeverity
message string
innerExceptions MagickException
return MagickException
    private static MagickException Create(ExceptionSeverity severity, string message, MagickException innerExceptions)
    {
      switch (severity)
      {
        case ExceptionSeverity.BlobWarning:
          return new MagickBlobWarningException(message, innerExceptions);
        case ExceptionSeverity.CacheWarning:
          return new MagickCacheWarningException(message, innerExceptions);
        case ExceptionSeverity.CoderWarning:
          return new MagickCoderWarningException(message, innerExceptions);
        case ExceptionSeverity.ConfigureWarning:
          return new MagickConfigureWarningException(message, innerExceptions);
        case ExceptionSeverity.CorruptImageWarning:
          return new MagickCorruptImageWarningException(message, innerExceptions);
        case ExceptionSeverity.DelegateWarning:
          return new MagickDelegateWarningException(message, innerExceptions);
        case ExceptionSeverity.DrawWarning:
          return new MagickDrawWarningException(message, innerExceptions);
        case ExceptionSeverity.FileOpenWarning:
          return new MagickFileOpenWarningException(message, innerExceptions);
        case ExceptionSeverity.ImageWarning:
          return new MagickImageWarningException(message, innerExceptions);
        case ExceptionSeverity.MissingDelegateWarning:
          return new MagickMissingDelegateWarningException(message, innerExceptions);
        case ExceptionSeverity.ModuleWarning:
          return new MagickModuleWarningException(message, innerExceptions);
        case ExceptionSeverity.OptionWarning:
          return new MagickOptionWarningException(message, innerExceptions);
        case ExceptionSeverity.PolicyWarning:
          return new MagickPolicyWarningException(message, innerExceptions);
        case ExceptionSeverity.RegistryWarning:
          return new MagickRegistryWarningException(message, innerExceptions);
        case ExceptionSeverity.ResourceLimitWarning:
          return new MagickResourceLimitWarningException(message, innerExceptions);
        case ExceptionSeverity.StreamWarning:
          return new MagickStreamWarningException(message, innerExceptions);
        case ExceptionSeverity.TypeWarning:
          return new MagickTypeWarningException(message, innerExceptions);
        case ExceptionSeverity.BlobError:
          return new MagickBlobErrorException(message, innerExceptions);
        case ExceptionSeverity.CacheError:
          return new MagickCacheErrorException(message, innerExceptions);
        case ExceptionSeverity.CoderError:
          return new MagickCoderErrorException(message, innerExceptions);
        case ExceptionSeverity.ConfigureError:
          return new MagickConfigureErrorException(message, innerExceptions);
        case ExceptionSeverity.CorruptImageError:
          return new MagickCorruptImageErrorException(message, innerExceptions);
        case ExceptionSeverity.DelegateError:
          return new MagickDelegateErrorException(message, innerExceptions);
        case ExceptionSeverity.DrawError:
          return new MagickDrawErrorException(message, innerExceptions);
        case ExceptionSeverity.FileOpenError:
          return new MagickFileOpenErrorException(message, innerExceptions);
        case ExceptionSeverity.ImageError:
          return new MagickImageErrorException(message, innerExceptions);
        case ExceptionSeverity.MissingDelegateError:
          return new MagickMissingDelegateErrorException(message, innerExceptions);
        case ExceptionSeverity.ModuleError:
          return new MagickModuleErrorException(message, innerExceptions);
        case ExceptionSeverity.OptionError:
          return new MagickOptionErrorException(message, innerExceptions);
        case ExceptionSeverity.PolicyError:
          return new MagickPolicyErrorException(message, innerExceptions);
        case ExceptionSeverity.RegistryError:
          return new MagickRegistryErrorException(message, innerExceptions);
        case ExceptionSeverity.ResourceLimitError:
          return new MagickResourceLimitErrorException(message, innerExceptions);
        case ExceptionSeverity.StreamError:
          return new MagickStreamErrorException(message, innerExceptions);
        case ExceptionSeverity.TypeError:
          return new MagickTypeErrorException(message, innerExceptions);
        default:
          if (severity < ExceptionSeverity.Error)
            return new MagickWarningException(message, innerExceptions);
          else
            return new MagickErrorException(message, innerExceptions);
      }
    }

Same methods

MagickExceptionHelper::Create ( IntPtr exception ) : MagickException

Usage Example

Example #1
0
            public IntPtr OptimizePlus(MagickImage image)
            {
                IntPtr exception = IntPtr.Zero;
                IntPtr result;

        #if ANYCPU
                if (NativeLibrary.Is64Bit)
        #endif
        #if WIN64 || ANYCPU
                result = NativeMethods.X64.MagickImageCollection_OptimizePlus(MagickImage.GetInstance(image), out exception);
        #endif
        #if ANYCPU
                else
        #endif
        #if !WIN64 || ANYCPU
                result = NativeMethods.X86.MagickImageCollection_OptimizePlus(MagickImage.GetInstance(image), out exception);
        #endif
                MagickException magickException = MagickExceptionHelper.Create(exception);
                if (MagickExceptionHelper.IsError(magickException))
                {
                    if (result != IntPtr.Zero)
                    {
                        Dispose(result);
                    }
                    throw magickException;
                }
                RaiseWarning(magickException);
                return(result);
            }
All Usage Examples Of ImageMagick.MagickExceptionHelper::Create