1 2 3 4 5<!DOCTYPE html> 6<html lang="en"> 7<head> 8 <meta charset="utf-8" /> 9 <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1,shrink-to-fit=no" /> 10 <title>ImageMagick - MagickCore, C API: Dealing with Exceptions</title> 11 <meta name="application-name" content="ImageMagick" /> 12 <meta name="description" content="Use ImageMagick® to create, edit, compose, and convert bitmap images. Resize an image, crop it, change its shades and colors, add captions, and more." /> 13 <meta name="application-url" content="https://imagemagick.org" /> 14 <meta name="generator" content="PHP" /> 15 <meta name="keywords" content="magickcore, c, api:, 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-2020 ImageMagick Studio LLC" /> 23 <meta name="distribution" content="Global" /> 24 <meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1" /> 25 <meta property='og:url' content='../../' /> 26 <meta property='og:title' content='ImageMagick' /> 27 <meta property='og:image' content='../../images/logo.png' /> 28 <meta property='og:type' content='website' /> 29 <meta property='og:site_name' content='ImageMagick' /> 30 <meta property='og:description' content="Convert, Edit, or Compose Bitmap Images" /> 31 <meta name="google-site-verification" content="_bMOCDpkx9ZAzBwb2kF3PRHbfUUdFj2uO8Jd1AXArz4" /> 32 <link href="exception.html" rel="canonical" /> 33 <link href="../../images/wand.png" rel="icon" /> 34 <link href="../../images/wand.ico" rel="shortcut icon" /> 35 <link href="../assets/magick.css" rel="stylesheet" /> 36</head> 37<body> 38 <nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark"> 39 <a class="navbar-brand" href="../../"><img class="d-block" id="icon" alt="ImageMagick" width="32" height="32" src="../../images/wand.ico"/></a> 40 <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsMagick" aria-controls="navbarsMagick" aria-expanded="false" aria-label="Toggle navigation"> 41 <span class="navbar-toggler-icon"></span> 42 </button> 43 44 <div class="navbar-collapse collapse" id="navbarsMagick" style=""> 45 <ul class="navbar-nav mr-auto"> 46 <li class="nav-item "> 47 <a class="nav-link" href="../../">Home <span class="sr-only">(current)</span></a> 48 </li> 49 <li class="nav-item "> 50 <a class="nav-link" href="../../www/download.html">Download</a> 51 </li> 52 <li class="nav-item "> 53 <a class="nav-link" href="../../www/command-line-tools.html">Tools</a> 54 </li> 55 <li class="nav-item "> 56 <a class="nav-link" href="../../www/command-line-processing.html">Command-line</a> 57 </li> 58 <li class="nav-item "> 59 <a class="nav-link" href="../../www/resources.html">Resources</a> 60 </li> 61 <li class="nav-item "> 62 <a class="nav-link" href="../../www/develop.html">Develop</a> 63 </li> 64 <li class="nav-item"> 65 <a class="nav-link" target="_blank" href="https://imagemagick.org/discourse-server/">Community</a> 66 </li> 67 </ul> 68 <form class="form-inline my-2 my-lg-0" action="../https://imagemagick.org/script/search.php"> 69 <input class="form-control mr-sm-2" type="text" name="q" placeholder="Search" aria-label="Search"> 70 <button class="btn btn-outline-success my-2 my-sm-0" type="submit" name="sa">Search</button> 71 </form> 72 </div> 73 </nav> 74 <div class="container"> 75 <script async="async" src="https://localhost/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" 76 style="display:block" 77 data-ad-client="ca-pub-3129977114552745" 78 data-ad-slot="6345125851" 79 data-full-width-responsive="true" 80 data-ad-format="horizontal"></ins> 81 <script> 82 (adsbygoogle = window.adsbygoogle || []).push({}); 83 </script> 84 85 </div> 86 87 <main class="container"> 88 <div class="magick-template"> 89<div class="magick-header"> 90<p class="text-center"><a href="exception.html#AcquireExceptionInfo">AcquireExceptionInfo</a> • <a href="exception.html#ClearMagickException">ClearMagickException</a> • <a href="exception.html#CatchException">CatchException</a> • <a href="exception.html#CloneExceptionInfo">CloneExceptionInfo</a> • <a href="exception.html#DestroyExceptionInfo">DestroyExceptionInfo</a> • <a href="exception.html#GetExceptionMessage">GetExceptionMessage</a> • <a href="exception.html#GetLocaleExceptionMessage">GetLocaleExceptionMessage</a> • <a href="exception.html#InheritException">InheritException</a> • <a href="exception.html#InitializeExceptionInfo">InitializeExceptionInfo</a> • <a href="exception.html#MagickError">MagickError</a> • <a href="exception.html#MagickFatalError">MagickFatalError</a> • <a href="exception.html#MagickWarning">MagickWarning</a> • <a href="exception.html#SetErrorHandler">SetErrorHandler</a> • <a href="exception.html#SetFatalErrorHandler">SetFatalErrorHandler</a> • <a href="exception.html#SetWarningHandler">SetWarningHandler</a> • <a href="exception.html#ThrowException">ThrowException</a></p> 91 92<h2><a href="../../api/MagickCore/exception_8c.html" id="AcquireExceptionInfo">AcquireExceptionInfo</a></h2> 93 94<p>AcquireExceptionInfo() allocates the ExceptionInfo structure.</p> 95 96<p>The format of the AcquireExceptionInfo method is:</p> 97 98<pre class="text"> 99ExceptionInfo *AcquireExceptionInfo(void) 100</pre> 101 102<h2><a href="../../api/MagickCore/exception_8c.html" id="ClearMagickException">ClearMagickException</a></h2> 103 104<p>ClearMagickException() clears any exception that may not have been caught yet.</p> 105 106<p>The format of the ClearMagickException method is:</p> 107 108<pre class="text"> 109ClearMagickException(ExceptionInfo *exception) 110</pre> 111 112<p>A description of each parameter follows:</p> 113 114<dd> 115</dd> 116 117<dd> </dd> 118<dl class="dl-horizontal"> 119<dt>exception</dt> 120<dd>the exception info. </dd> 121 122<dd> </dd> 123</dl> 124<h2><a href="../../api/MagickCore/exception_8c.html" id="CatchException">CatchException</a></h2> 125 126<p>CatchException() returns if no exceptions is found otherwise it reports the exception as a warning, error, or fatal depending on the severity.</p> 127 128<p>The format of the CatchException method is:</p> 129 130<pre class="text"> 131CatchException(ExceptionInfo *exception) 132</pre> 133 134<p>A description of each parameter follows:</p> 135 136<dd> 137</dd> 138 139<dd> </dd> 140<dl class="dl-horizontal"> 141<dt>exception</dt> 142<dd>the exception info. </dd> 143 144<dd> </dd> 145</dl> 146<h2><a href="../../api/MagickCore/exception_8c.html" id="CloneExceptionInfo">CloneExceptionInfo</a></h2> 147 148<p>CloneExceptionInfo() clones the ExceptionInfo structure.</p> 149 150<p>The format of the CloneExceptionInfo method is:</p> 151 152<pre class="text"> 153ExceptionInfo *CloneException(ExceptionInfo *exception) 154</pre> 155 156<p>A description of each parameter follows:</p> 157 158<dd> 159</dd> 160 161<dd> </dd> 162<dl class="dl-horizontal"> 163<dt>exception</dt> 164<dd>the exception info. </dd> 165 166<dd> </dd> 167</dl> 168<h2><a href="../../api/MagickCore/exception_8c.html" id="DestroyExceptionInfo">DestroyExceptionInfo</a></h2> 169 170<p>DestroyExceptionInfo() deallocates memory associated with an exception.</p> 171 172<p>The format of the DestroyExceptionInfo method is:</p> 173 174<pre class="text"> 175ExceptionInfo *DestroyExceptionInfo(ExceptionInfo *exception) 176</pre> 177 178<p>A description of each parameter follows:</p> 179 180<dd> 181</dd> 182 183<dd> </dd> 184<dl class="dl-horizontal"> 185<dt>exception</dt> 186<dd>the exception info. </dd> 187 188<dd> </dd> 189</dl> 190<h2><a href="../../api/MagickCore/exception_8c.html" id="GetExceptionMessage">GetExceptionMessage</a></h2> 191 192<p>GetExceptionMessage() returns the error message defined by the specified error code.</p> 193 194<p>The format of the GetExceptionMessage method is:</p> 195 196<pre class="text"> 197char *GetExceptionMessage(const int error) 198</pre> 199 200<p>A description of each parameter follows:</p> 201 202<dd> 203</dd> 204 205<dd> </dd> 206<dl class="dl-horizontal"> 207<dt>error</dt> 208<dd>the error code. </dd> 209 210<dd> </dd> 211</dl> 212<h2><a href="../../api/MagickCore/exception_8c.html" id="GetLocaleExceptionMessage">GetLocaleExceptionMessage</a></h2> 213 214<p>GetLocaleExceptionMessage() converts a enumerated exception severity and tag to a message in the current locale.</p> 215 216<p>The format of the GetLocaleExceptionMessage method is:</p> 217 218<pre class="text"> 219const char *GetLocaleExceptionMessage(const ExceptionType severity, 220 const char *tag) 221</pre> 222 223<p>A description of each parameter follows:</p> 224 225<dd> 226</dd> 227 228<dd> </dd> 229<dl class="dl-horizontal"> 230<dt>severity</dt> 231<dd>the severity of the exception. </dd> 232 233<dd> </dd> 234<dt>tag</dt> 235<dd>the message tag. </dd> 236 237<dd> </dd> 238</dl> 239<h2><a href="../../api/MagickCore/exception_8c.html" id="InheritException">InheritException</a></h2> 240 241<p>InheritException() inherits an exception from a related exception.</p> 242 243<p>The format of the InheritException method is:</p> 244 245<pre class="text"> 246InheritException(ExceptionInfo *exception,const ExceptionInfo *relative) 247</pre> 248 249<p>A description of each parameter follows:</p> 250 251<dd> 252</dd> 253 254<dd> </dd> 255<dl class="dl-horizontal"> 256<dt>exception</dt> 257<dd>the exception info. </dd> 258 259<dd> </dd> 260<dt>relative</dt> 261<dd>the related exception info. </dd> 262 263<dd> </dd> 264</dl> 265<h2><a href="../../api/MagickCore/exception_8c.html" id="InitializeExceptionInfo">InitializeExceptionInfo</a></h2> 266 267<p>InitializeExceptionInfo() initializes an exception to default values.</p> 268 269<p>The format of the InitializeExceptionInfo method is:</p> 270 271<pre class="text"> 272InitializeExceptionInfo(ExceptionInfo *exception) 273</pre> 274 275<p>A description of each parameter follows:</p> 276 277<dd> 278</dd> 279 280<dd> </dd> 281<dl class="dl-horizontal"> 282<dt>exception</dt> 283<dd>the exception info. </dd> 284 285<dd> </dd> 286</dl> 287<h2><a href="../../api/MagickCore/exception_8c.html" id="MagickError">MagickError</a></h2> 288 289<p>MagickError() calls the exception handler methods with an error reason.</p> 290 291<p>The format of the MagickError method is:</p> 292 293<pre class="text"> 294void MagickError(const ExceptionType error,const char *reason, 295 const char *description) 296</pre> 297 298<p>A description of each parameter follows:</p> 299 300<dd> 301</dd> 302 303<dd> </dd> 304<dl class="dl-horizontal"> 305<dt>exception</dt> 306<dd>Specifies the numeric error category. </dd> 307 308<dd> </dd> 309<dt>reason</dt> 310<dd>Specifies the reason to display before terminating the program. </dd> 311 312<dd> </dd> 313<dt>description</dt> 314<dd>Specifies any description to the reason. </dd> 315 316<dd> </dd> 317</dl> 318<h2><a href="../../api/MagickCore/exception_8c.html" id="MagickFatalError">MagickFatalError</a></h2> 319 320<p>MagickFatalError() calls the fatal exception handler methods with an error reason.</p> 321 322<p>The format of the MagickError method is:</p> 323 324<pre class="text"> 325void MagickFatalError(const ExceptionType error,const char *reason, 326 const char *description) 327</pre> 328 329<p>A description of each parameter follows:</p> 330 331<dd> 332</dd> 333 334<dd> </dd> 335<dl class="dl-horizontal"> 336<dt>exception</dt> 337<dd>Specifies the numeric error category. </dd> 338 339<dd> </dd> 340<dt>reason</dt> 341<dd>Specifies the reason to display before terminating the program. </dd> 342 343<dd> </dd> 344<dt>description</dt> 345<dd>Specifies any description to the reason. </dd> 346 347<dd> </dd> 348</dl> 349<h2><a href="../../api/MagickCore/exception_8c.html" id="MagickWarning">MagickWarning</a></h2> 350 351<p>MagickWarning() calls the warning handler methods with a warning reason.</p> 352 353<p>The format of the MagickWarning method is:</p> 354 355<pre class="text"> 356void MagickWarning(const ExceptionType warning,const char *reason, 357 const char *description) 358</pre> 359 360<p>A description of each parameter follows:</p> 361 362<dd> 363</dd> 364 365<dd> </dd> 366<dl class="dl-horizontal"> 367<dt>warning</dt> 368<dd>the warning severity. </dd> 369 370<dd> </dd> 371<dt>reason</dt> 372<dd>Define the reason for the warning. </dd> 373 374<dd> </dd> 375<dt>description</dt> 376<dd>Describe the warning. </dd> 377 378<dd> </dd> 379</dl> 380<h2><a href="../../api/MagickCore/exception_8c.html" id="SetErrorHandler">SetErrorHandler</a></h2> 381 382<p>SetErrorHandler() sets the exception handler to the specified method and returns the previous exception handler.</p> 383 384<p>The format of the SetErrorHandler method is:</p> 385 386<pre class="text"> 387ErrorHandler SetErrorHandler(ErrorHandler handler) 388</pre> 389 390<p>A description of each parameter follows:</p> 391 392<dd> 393</dd> 394 395<dd> </dd> 396<dl class="dl-horizontal"> 397<dt>handler</dt> 398<dd>the method to handle errors. </dd> 399 400<dd> </dd> 401</dl> 402<h2><a href="../../api/MagickCore/exception_8c.html" id="SetFatalErrorHandler">SetFatalErrorHandler</a></h2> 403 404<p>SetFatalErrorHandler() sets the fatal exception handler to the specified method and returns the previous fatal exception handler.</p> 405 406<p>The format of the SetErrorHandler method is:</p> 407 408<pre class="text"> 409ErrorHandler SetErrorHandler(ErrorHandler handler) 410</pre> 411 412<p>A description of each parameter follows:</p> 413 414<dd> 415</dd> 416 417<dd> </dd> 418<dl class="dl-horizontal"> 419<dt>handler</dt> 420<dd>the method to handle errors. </dd> 421 422<dd> </dd> 423</dl> 424<h2><a href="../../api/MagickCore/exception_8c.html" id="SetWarningHandler">SetWarningHandler</a></h2> 425 426<p>SetWarningHandler() sets the warning handler to the specified method and returns the previous warning handler.</p> 427 428<p>The format of the SetWarningHandler method is:</p> 429 430<pre class="text"> 431ErrorHandler SetWarningHandler(ErrorHandler handler) 432</pre> 433 434<p>A description of each parameter follows:</p> 435 436<dd> 437</dd> 438 439<dd> </dd> 440<dl class="dl-horizontal"> 441<dt>handler</dt> 442<dd>the method to handle warnings. </dd> 443 444<dd> </dd> 445</dl> 446<h2><a href="../../api/MagickCore/exception_8c.html" id="ThrowException">ThrowException</a></h2> 447 448<p>ThrowException() throws an exception with the specified severity code, reason, and optional description.</p> 449 450<p>The format of the ThrowException method is:</p> 451 452<pre class="text"> 453MagickBooleanType ThrowException(ExceptionInfo *exception, 454 const ExceptionType severity,const char *reason, 455 const char *description) 456</pre> 457 458<p>A description of each parameter follows:</p> 459 460<dd> 461</dd> 462 463<dd> </dd> 464<dl class="dl-horizontal"> 465<dt>exception</dt> 466<dd>the exception info. </dd> 467 468<dd> </dd> 469<dt>severity</dt> 470<dd>the severity of the exception. </dd> 471 472<dd> </dd> 473<dt>reason</dt> 474<dd>the reason for the exception. </dd> 475 476<dd> </dd> 477<dt>description</dt> 478<dd>the exception description. </dd> 479 480<dd> </dd> 481</dl> 482</div> 483 </div> 484 </main><!-- /.container --> 485 <footer class="magick-footer"> 486 <p><a href="../../www/security-policy.html">Security</a> • 487 <a href="../../www/architecture.html">Architecture</a> 488 489 <a href="exception.html#"><img class="d-inline" id="wand" alt="And Now a Touch of Magick" width="16" height="16" src="../../images/wand.ico"/></a> 490 491 <a href="../../www/links.html">Related</a> • 492 <a href="../../www/sitemap.html">Sitemap</a> 493 <br/> 494 <a href="../../www/support.html">Donate</a> • 495 <a href="http://pgp.mit.edu/pks/lookup?op=get&search=0x89AB63D48277377A">Public Key</a> • 496 <a href="../../www/contact.html">Contact Us</a> 497 <br/> 498 <small>© 1999-2020 ImageMagick Studio LLC</small></p> 499 </footer> 500 501 <!-- Javascript assets --> 502 <script src="../assets/magick.js" crossorigin="anonymous"></script> 503 <script>window.jQuery || document.write('<script src="https://localhost/ajax/libs/jquery/3.4.1/jquery.min.js"><\/script>')</script> 504</body> 505</html> 506<!-- Magick Cache 29th December 2019 14:22 -->