1 module dmagick.c.exception; 2 3 import core.vararg; 4 5 import dmagick.c.magickType; 6 import dmagick.c.magickVersion; 7 import dmagick.c.semaphore; 8 9 extern(C) 10 { 11 enum ExceptionType 12 { 13 UndefinedException, 14 WarningException = 300, 15 ResourceLimitWarning = 300, 16 TypeWarning = 305, 17 OptionWarning = 310, 18 DelegateWarning = 315, 19 MissingDelegateWarning = 320, 20 CorruptImageWarning = 325, 21 FileOpenWarning = 330, 22 BlobWarning = 335, 23 StreamWarning = 340, 24 CacheWarning = 345, 25 CoderWarning = 350, 26 FilterWarning = 352, 27 ModuleWarning = 355, 28 DrawWarning = 360, 29 ImageWarning = 365, 30 WandWarning = 370, 31 RandomWarning = 375, 32 XServerWarning = 380, 33 MonitorWarning = 385, 34 RegistryWarning = 390, 35 ConfigureWarning = 395, 36 PolicyWarning = 399, 37 ErrorException = 400, 38 ResourceLimitError = 400, 39 TypeError = 405, 40 OptionError = 410, 41 DelegateError = 415, 42 MissingDelegateError = 420, 43 CorruptImageError = 425, 44 FileOpenError = 430, 45 BlobError = 435, 46 StreamError = 440, 47 CacheError = 445, 48 CoderError = 450, 49 FilterError = 452, 50 ModuleError = 455, 51 DrawError = 460, 52 ImageError = 465, 53 WandError = 470, 54 RandomError = 475, 55 XServerError = 480, 56 MonitorError = 485, 57 RegistryError = 490, 58 ConfigureError = 495, 59 PolicyError = 499, 60 FatalErrorException = 700, 61 ResourceLimitFatalError = 700, 62 TypeFatalError = 705, 63 OptionFatalError = 710, 64 DelegateFatalError = 715, 65 MissingDelegateFatalError = 720, 66 CorruptImageFatalError = 725, 67 FileOpenFatalError = 730, 68 BlobFatalError = 735, 69 StreamFatalError = 740, 70 CacheFatalError = 745, 71 CoderFatalError = 750, 72 FilterFatalError = 752, 73 ModuleFatalError = 755, 74 DrawFatalError = 760, 75 ImageFatalError = 765, 76 WandFatalError = 770, 77 RandomFatalError = 775, 78 XServerFatalError = 780, 79 MonitorFatalError = 785, 80 RegistryFatalError = 790, 81 ConfigureFatalError = 795, 82 PolicyFatalError = 799 83 } 84 85 struct ExceptionInfo 86 { 87 ExceptionType 88 severity; 89 90 int 91 error_number; 92 93 char* 94 reason, 95 description; 96 97 void* 98 exceptions; 99 100 MagickBooleanType 101 relinquish; 102 103 SemaphoreInfo* 104 semaphore; 105 106 size_t 107 signature; 108 } 109 110 alias void function(const ExceptionType, const(char)*, const(char)*) ErrorHandler; 111 alias void function(const ExceptionType, const(char)*, const(char)*) FatalErrorHandler; 112 alias void function(const ExceptionType, const(char)*, const(char)*) WarningHandler; 113 114 char* GetExceptionMessage(const int); 115 116 const(char*) GetLocaleExceptionMessage(const ExceptionType, const(char)*); 117 118 ErrorHandler SetErrorHandler(ErrorHandler); 119 120 ExceptionInfo* AcquireExceptionInfo(); 121 122 static if ( MagickLibVersion >= 0x669 ) 123 { 124 ExceptionInfo* CloneExceptionInfo(ExceptionInfo*); 125 } 126 127 ExceptionInfo* DestroyExceptionInfo(ExceptionInfo*); 128 129 FatalErrorHandler SetFatalErrorHandler(FatalErrorHandler); 130 131 MagickBooleanType ThrowException(ExceptionInfo*, const ExceptionType, const(char)*, const(char)*); 132 MagickBooleanType ThrowMagickException(ExceptionInfo*, const(char)*, const(char)*, const size_t, const ExceptionType, const(char)*, const(char)*, ...); 133 MagickBooleanType ThrowMagickExceptionList(ExceptionInfo*, const(char)*, const(char)*, const size_t, const ExceptionType, const(char)*, const(char)*, va_list); 134 135 void CatchException(ExceptionInfo*); 136 void ClearMagickException(ExceptionInfo*); 137 138 static if ( MagickLibVersion < 0x689 ) 139 { 140 void GetExceptionInfo(ExceptionInfo*); 141 } 142 143 void InheritException(ExceptionInfo*, const(ExceptionInfo)*); 144 void MagickError(const ExceptionType, const(char)*, const(char)*); 145 void MagickFatalError(const ExceptionType, const(char)*, const(char)*); 146 void MagickWarning(const ExceptionType, const(char)*, const(char)*); 147 148 WarningHandler SetWarningHandler(WarningHandler); 149 }