Example #1
0
        public static MagickException CreateException(IntPtr exception)
        {
            var severity    = (ExceptionSeverity)NativeMagickExceptionHelper.Severity(exception);
            var message     = NativeMagickExceptionHelper.Message(exception);
            var description = NativeMagickExceptionHelper.Description(exception);

            if (!string.IsNullOrEmpty(description))
            {
                message += " (" + description + ")";
            }

            if (message is null || message.Length == 0)
            {
                message = string.Empty;
            }

            var result = Create(severity, message);

            var relatedExceptions = CreateRelatedExceptions(exception);

            if (relatedExceptions != null)
            {
                result.SetRelatedException(relatedExceptions);
            }

            return(result);
        }
Example #2
0
        public static MagickException CreateException(IntPtr exception)
        {
            ExceptionSeverity severity    = (ExceptionSeverity)NativeMagickExceptionHelper.Severity(exception);
            string            message     = NativeMagickExceptionHelper.Message(exception);
            string            description = NativeMagickExceptionHelper.Description(exception);

            if (!string.IsNullOrEmpty(description))
            {
                message += " (" + description + ")";
            }

            List <MagickException> innerExceptions = CreateRelatedExceptions(exception);

            MagickException result = Create(severity, message);

            result.SetRelatedException(innerExceptions);

            return(result);
        }