Home | History | Annotate | Download | only in api
      1 
      2 
      3 
      4 
      5 <!DOCTYPE html>
      6 <html lang="en">
      7 <head>
      8   <meta name="google-site-verification" content="_bMOCDpkx9ZAzBwb2kF3PRHbfUUdFj2uO8Jd1AXArz4" />
      9     <title>ImageMagick: MagickCore, C API for ImageMagick: Dealing with Exceptions</title>
     10   <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
     11   <meta name="application-name" content="ImageMagick"/>
     12   <meta name="description" content="ImageMagick is a software suite to create, edit, compose, or convert bitmap images. It can read and write images in a variety of formats (over 200) including PNG, JPEG, JPEG-2000, GIF, WebP, Postscript, PDF, and SVG. Use ImageMagick to resize, flip, mirror, rotate, distort, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bzier curves."/>
     13   <meta name="application-url" content="http://www.imagemagick.org"/>
     14   <meta name="generator" content="PHP"/>
     15   <meta name="keywords" content="magickcore, c, api, for, imagemagick:, dealing, with, exceptions, ImageMagick, PerlMagick, image processing, image, photo, software, Magick++, OpenMP, convert"/>
     16   <meta name="rating" content="GENERAL"/>
     17   <meta name="robots" content="INDEX, FOLLOW"/>
     18   <meta name="generator" content="ImageMagick Studio LLC"/>
     19   <meta name="author" content="ImageMagick Studio LLC"/>
     20   <meta name="revisit-after" content="2 DAYS"/>
     21   <meta name="resource-type" content="document"/>
     22   <meta name="copyright" content="Copyright (c) 1999-2016 ImageMagick Studio LLC"/>
     23   <meta name="distribution" content="Global"/>
     24   <meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1"/>
     25   <link rel="icon" href="../image/wand.png"/>
     26   <link rel="shortcut icon" href="../image/wand.ico"/>
     27   <link rel="stylesheet" href="../css/magick.php"/>
     28 </head>
     29 <body>
     30 <div class="main">
     31 <div class="magick-masthead">
     32   <div class="container">
     33     <script async="async" src="http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>    <ins class="adsbygoogle"
     34          style="display:block"
     35          data-ad-client="ca-pub-3129977114552745"
     36          data-ad-slot="6345125851"
     37          data-ad-format="auto"></ins>
     38     <script>
     39       (adsbygoogle = window.adsbygoogle || []).push({});
     40     </script>
     41     <nav class="magick-nav">
     42       <a class="magick-nav-item " href="../index.php">Home</a>
     43       <a class="magick-nav-item " href="../script/binary-releases.php">Download</a>
     44       <a class="magick-nav-item " href="../script/command-line-tools.php">Tools</a>
     45       <a class="magick-nav-item " href="../script/command-line-options.php">Options</a>
     46       <a class="magick-nav-item " href="../script/resources.php">Resources</a>
     47       <a class="magick-nav-item " href="../script/api.php">Develop</a>
     48       <a class="magick-nav-item " href="../script/search.php">Search</a>
     49       <a class="magick-nav-item pull-right" href="http://www.imagemagick.org/discourse-server/">Community</a>
     50     </nav>
     51   </div>
     52 </div>
     53 <div class="container">
     54 <div class="magick-header">
     55 <p class="text-center"><a href="exception.php#AcquireExceptionInfo">AcquireExceptionInfo</a> &bull; <a href="exception.php#ClearMagickException">ClearMagickException</a> &bull; <a href="exception.php#CatchException">CatchException</a> &bull; <a href="exception.php#CloneExceptionInfo">CloneExceptionInfo</a> &bull; <a href="exception.php#DestroyExceptionInfo">DestroyExceptionInfo</a> &bull; <a href="exception.php#GetExceptionMessage">GetExceptionMessage</a> &bull; <a href="exception.php#GetLocaleExceptionMessage">GetLocaleExceptionMessage</a> &bull; <a href="exception.php#InheritException">InheritException</a> &bull; <a href="exception.php#InitializeExceptionInfo">InitializeExceptionInfo</a> &bull; <a href="exception.php#MagickError">MagickError</a> &bull; <a href="exception.php#MagickFatalError">MagickFatalError</a> &bull; <a href="exception.php#MagickWarning">MagickWarning</a> &bull; <a href="exception.php#SetErrorHandler">SetErrorHandler</a> &bull; <a href="exception.php#SetFatalErrorHandler">SetFatalErrorHandler</a> &bull; <a href="exception.php#SetWarningHandler">SetWarningHandler</a> &bull; <a href="exception.php#ThrowException">ThrowException</a></p>
     56 
     57 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="AcquireExceptionInfo">AcquireExceptionInfo</a></h2>
     58 
     59 <p>AcquireExceptionInfo() allocates the ExceptionInfo structure.</p>
     60 
     61 <p>The format of the AcquireExceptionInfo method is:</p>
     62 
     63 <pre class="text">
     64 ExceptionInfo *AcquireExceptionInfo(void)
     65 </pre>
     66 
     67 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="ClearMagickException">ClearMagickException</a></h2>
     68 
     69 <p>ClearMagickException() clears any exception that may not have been caught yet.</p>
     70 
     71 <p>The format of the ClearMagickException method is:</p>
     72 
     73 <pre class="text">
     74 ClearMagickException(ExceptionInfo *exception)
     75 </pre>
     76 
     77 <p>A description of each parameter follows:</p>
     78 
     79 <dd>
     80 </dd>
     81 
     82 <dd> </dd>
     83 <dl class="dl-horizontal">
     84 <dt>exception</dt>
     85 <dd>the exception info. </dd>
     86 
     87 <dd>  </dd>
     88 </dl>
     89 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="CatchException">CatchException</a></h2>
     90 
     91 <p>CatchException() returns if no exceptions is found otherwise it reports the exception as a warning, error, or fatal depending on the severity.</p>
     92 
     93 <p>The format of the CatchException method is:</p>
     94 
     95 <pre class="text">
     96 CatchException(ExceptionInfo *exception)
     97 </pre>
     98 
     99 <p>A description of each parameter follows:</p>
    100 
    101 <dd>
    102 </dd>
    103 
    104 <dd> </dd>
    105 <dl class="dl-horizontal">
    106 <dt>exception</dt>
    107 <dd>the exception info. </dd>
    108 
    109 <dd>  </dd>
    110 </dl>
    111 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="CloneExceptionInfo">CloneExceptionInfo</a></h2>
    112 
    113 <p>CloneExceptionInfo() clones the ExceptionInfo structure.</p>
    114 
    115 <p>The format of the CloneExceptionInfo method is:</p>
    116 
    117 <pre class="text">
    118 ExceptionInfo *CloneException(ExceptionInfo *exception)
    119 </pre>
    120 
    121 <p>A description of each parameter follows:</p>
    122 
    123 <dd>
    124 </dd>
    125 
    126 <dd> </dd>
    127 <dl class="dl-horizontal">
    128 <dt>exception</dt>
    129 <dd>the exception info. </dd>
    130 
    131 <dd>  </dd>
    132 </dl>
    133 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="DestroyExceptionInfo">DestroyExceptionInfo</a></h2>
    134 
    135 <p>DestroyExceptionInfo() deallocates memory associated with an exception.</p>
    136 
    137 <p>The format of the DestroyExceptionInfo method is:</p>
    138 
    139 <pre class="text">
    140 ExceptionInfo *DestroyExceptionInfo(ExceptionInfo *exception)
    141 </pre>
    142 
    143 <p>A description of each parameter follows:</p>
    144 
    145 <dd>
    146 </dd>
    147 
    148 <dd> </dd>
    149 <dl class="dl-horizontal">
    150 <dt>exception</dt>
    151 <dd>the exception info. </dd>
    152 
    153 <dd>  </dd>
    154 </dl>
    155 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="GetExceptionMessage">GetExceptionMessage</a></h2>
    156 
    157 <p>GetExceptionMessage() returns the error message defined by the specified error code.</p>
    158 
    159 <p>The format of the GetExceptionMessage method is:</p>
    160 
    161 <pre class="text">
    162 char *GetExceptionMessage(const int error)
    163 </pre>
    164 
    165 <p>A description of each parameter follows:</p>
    166 
    167 <dd>
    168 </dd>
    169 
    170 <dd> </dd>
    171 <dl class="dl-horizontal">
    172 <dt>error</dt>
    173 <dd>the error code. </dd>
    174 
    175 <dd>  </dd>
    176 </dl>
    177 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="GetLocaleExceptionMessage">GetLocaleExceptionMessage</a></h2>
    178 
    179 <p>GetLocaleExceptionMessage() converts a enumerated exception severity and tag to a message in the current locale.</p>
    180 
    181 <p>The format of the GetLocaleExceptionMessage method is:</p>
    182 
    183 <pre class="text">
    184 const char *GetLocaleExceptionMessage(const ExceptionType severity,
    185   const char *tag)
    186 </pre>
    187 
    188 <p>A description of each parameter follows:</p>
    189 
    190 <dd>
    191 </dd>
    192 
    193 <dd> </dd>
    194 <dl class="dl-horizontal">
    195 <dt>severity</dt>
    196 <dd>the severity of the exception. </dd>
    197 
    198 <dd> </dd>
    199 <dt>tag</dt>
    200 <dd>the message tag. </dd>
    201 
    202 <dd>  </dd>
    203 </dl>
    204 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="InheritException">InheritException</a></h2>
    205 
    206 <p>InheritException() inherits an exception from a related exception.</p>
    207 
    208 <p>The format of the InheritException method is:</p>
    209 
    210 <pre class="text">
    211 InheritException(ExceptionInfo *exception,const ExceptionInfo *relative)
    212 </pre>
    213 
    214 <p>A description of each parameter follows:</p>
    215 
    216 <dd>
    217 </dd>
    218 
    219 <dd> </dd>
    220 <dl class="dl-horizontal">
    221 <dt>exception</dt>
    222 <dd>the exception info. </dd>
    223 
    224 <dd> </dd>
    225 <dt>relative</dt>
    226 <dd>the related exception info. </dd>
    227 
    228 <dd>  </dd>
    229 </dl>
    230 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="InitializeExceptionInfo">InitializeExceptionInfo</a></h2>
    231 
    232 <p>InitializeExceptionInfo() initializes an exception to default values.</p>
    233 
    234 <p>The format of the InitializeExceptionInfo method is:</p>
    235 
    236 <pre class="text">
    237 InitializeExceptionInfo(ExceptionInfo *exception)
    238 </pre>
    239 
    240 <p>A description of each parameter follows:</p>
    241 
    242 <dd>
    243 </dd>
    244 
    245 <dd> </dd>
    246 <dl class="dl-horizontal">
    247 <dt>exception</dt>
    248 <dd>the exception info. </dd>
    249 
    250 <dd>  </dd>
    251 </dl>
    252 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="MagickError">MagickError</a></h2>
    253 
    254 <p>MagickError() calls the exception handler methods with an error reason.</p>
    255 
    256 <p>The format of the MagickError method is:</p>
    257 
    258 <pre class="text">
    259 void MagickError(const ExceptionType error,const char *reason,
    260   const char *description)
    261 </pre>
    262 
    263 <p>A description of each parameter follows:</p>
    264 
    265 <dd>
    266 </dd>
    267 
    268 <dd> </dd>
    269 <dl class="dl-horizontal">
    270 <dt>exception</dt>
    271 <dd>Specifies the numeric error category. </dd>
    272 
    273 <dd> </dd>
    274 <dt>reason</dt>
    275 <dd>Specifies the reason to display before terminating the program. </dd>
    276 
    277 <dd> </dd>
    278 <dt>description</dt>
    279 <dd>Specifies any description to the reason. </dd>
    280 
    281 <dd>  </dd>
    282 </dl>
    283 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="MagickFatalError">MagickFatalError</a></h2>
    284 
    285 <p>MagickFatalError() calls the fatal exception handler methods with an error reason.</p>
    286 
    287 <p>The format of the MagickError method is:</p>
    288 
    289 <pre class="text">
    290 void MagickFatalError(const ExceptionType error,const char *reason,
    291   const char *description)
    292 </pre>
    293 
    294 <p>A description of each parameter follows:</p>
    295 
    296 <dd>
    297 </dd>
    298 
    299 <dd> </dd>
    300 <dl class="dl-horizontal">
    301 <dt>exception</dt>
    302 <dd>Specifies the numeric error category. </dd>
    303 
    304 <dd> </dd>
    305 <dt>reason</dt>
    306 <dd>Specifies the reason to display before terminating the program. </dd>
    307 
    308 <dd> </dd>
    309 <dt>description</dt>
    310 <dd>Specifies any description to the reason. </dd>
    311 
    312 <dd>  </dd>
    313 </dl>
    314 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="MagickWarning">MagickWarning</a></h2>
    315 
    316 <p>MagickWarning() calls the warning handler methods with a warning reason.</p>
    317 
    318 <p>The format of the MagickWarning method is:</p>
    319 
    320 <pre class="text">
    321 void MagickWarning(const ExceptionType warning,const char *reason,
    322   const char *description)
    323 </pre>
    324 
    325 <p>A description of each parameter follows:</p>
    326 
    327 <dd>
    328 </dd>
    329 
    330 <dd> </dd>
    331 <dl class="dl-horizontal">
    332 <dt>warning</dt>
    333 <dd>the warning severity. </dd>
    334 
    335 <dd> </dd>
    336 <dt>reason</dt>
    337 <dd>Define the reason for the warning. </dd>
    338 
    339 <dd> </dd>
    340 <dt>description</dt>
    341 <dd>Describe the warning. </dd>
    342 
    343 <dd>  </dd>
    344 </dl>
    345 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="SetErrorHandler">SetErrorHandler</a></h2>
    346 
    347 <p>SetErrorHandler() sets the exception handler to the specified method and returns the previous exception handler.</p>
    348 
    349 <p>The format of the SetErrorHandler method is:</p>
    350 
    351 <pre class="text">
    352 ErrorHandler SetErrorHandler(ErrorHandler handler)
    353 </pre>
    354 
    355 <p>A description of each parameter follows:</p>
    356 
    357 <dd>
    358 </dd>
    359 
    360 <dd> </dd>
    361 <dl class="dl-horizontal">
    362 <dt>handler</dt>
    363 <dd>the method to handle errors. </dd>
    364 
    365 <dd>  </dd>
    366 </dl>
    367 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="SetFatalErrorHandler">SetFatalErrorHandler</a></h2>
    368 
    369 <p>SetFatalErrorHandler() sets the fatal exception handler to the specified method and returns the previous fatal exception handler.</p>
    370 
    371 <p>The format of the SetErrorHandler method is:</p>
    372 
    373 <pre class="text">
    374 ErrorHandler SetErrorHandler(ErrorHandler handler)
    375 </pre>
    376 
    377 <p>A description of each parameter follows:</p>
    378 
    379 <dd>
    380 </dd>
    381 
    382 <dd> </dd>
    383 <dl class="dl-horizontal">
    384 <dt>handler</dt>
    385 <dd>the method to handle errors. </dd>
    386 
    387 <dd>  </dd>
    388 </dl>
    389 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="SetWarningHandler">SetWarningHandler</a></h2>
    390 
    391 <p>SetWarningHandler() sets the warning handler to the specified method and returns the previous warning handler.</p>
    392 
    393 <p>The format of the SetWarningHandler method is:</p>
    394 
    395 <pre class="text">
    396 ErrorHandler SetWarningHandler(ErrorHandler handler)
    397 </pre>
    398 
    399 <p>A description of each parameter follows:</p>
    400 
    401 <dd>
    402 </dd>
    403 
    404 <dd> </dd>
    405 <dl class="dl-horizontal">
    406 <dt>handler</dt>
    407 <dd>the method to handle warnings. </dd>
    408 
    409 <dd>  </dd>
    410 </dl>
    411 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="ThrowException">ThrowException</a></h2>
    412 
    413 <p>ThrowException() throws an exception with the specified severity code, reason, and optional description.</p>
    414 
    415 <p>The format of the ThrowException method is:</p>
    416 
    417 <pre class="text">
    418 MagickBooleanType ThrowException(ExceptionInfo *exception,
    419   const ExceptionType severity,const char *reason,
    420   const char *description)
    421 </pre>
    422 
    423 <p>A description of each parameter follows:</p>
    424 
    425 <dd>
    426 </dd>
    427 
    428 <dd> </dd>
    429 <dl class="dl-horizontal">
    430 <dt>exception</dt>
    431 <dd>the exception info. </dd>
    432 
    433 <dd> </dd>
    434 <dt>severity</dt>
    435 <dd>the severity of the exception. </dd>
    436 
    437 <dd> </dd>
    438 <dt>reason</dt>
    439 <dd>the reason for the exception. </dd>
    440 
    441 <dd> </dd>
    442 <dt>description</dt>
    443 <dd>the exception description. </dd>
    444 
    445 <dd>  </dd>
    446 </dl>
    447 </div>
    448   <footer class="magick-footer">
    449     <p><a href="../script/support.php">Donate</a> 
    450      <a href="../script/sitemap.php">Sitemap</a> 
    451     <a href="../script/links.php">Related</a> 
    452     <a href="../script/architecture.php">Architecture</a>
    453 </p>
    454     <p><a href="exception.php#">Back to top</a> 
    455     <a href="http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x89AB63D48277377A">Public Key</a> 
    456     <a href="../script/contact.php">Contact Us</a></p>
    457         <p><small>  1999-2016 ImageMagick Studio LLC</small></p>
    458   </footer>
    459 </div><!-- /.container -->
    460 
    461   <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    462   <script src="http://nextgen.imagemagick.org/js/magick.php"></script>
    463 </div>
    464 </body>
    465 </html>
    466