5 <title>ImageMagick: MagickCore, C API for ImageMagick: Dealing with Exceptions</title>
6 <meta http-equiv="content-type" content="text/html; charset=utf-8">
7 <meta name="application-name" content="ImageMagick">
8 <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 Bézier curves.">
9 <meta name="application-url" content="http://www.imagemagick.org">
10 <meta name="generator" content="PHP">
11 <meta name="keywords" content="magickcore, c, api, for, imagemagick:, dealing, with, exceptions, ImageMagick, PerlMagick, image processing, image, photo, software, Magick++, OpenMP, convert">
12 <meta name="rating" content="GENERAL">
13 <meta name="robots" content="INDEX, FOLLOW">
14 <meta name="generator" content="ImageMagick Studio LLC">
15 <meta name="author" content="ImageMagick Studio LLC">
16 <meta name="revisit-after" content="2 DAYS">
17 <meta name="resource-type" content="document">
18 <meta name="copyright" content="Copyright (c) 1999-2015 ImageMagick Studio LLC">
19 <meta name="distribution" content="Global">
20 <meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1">
21 <link rel="icon" href="../images/wand.png">
22 <link rel="shortcut icon" href="../images/wand.ico">
23 <link rel="stylesheet" href="../css/magick.html">
27 <div class="magick-masthead">
28 <div class="container">
29 <script async src="http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-3129977114552745" data-ad-slot="6345125851" data-ad-format="auto"></ins>
31 (adsbygoogle = window.adsbygoogle || []).push({});
33 <nav class="magick-nav">
34 <a class="magick-nav-item " href="../index.html">Home</a>
35 <a class="magick-nav-item " href="../binary-releases.html">Download</a>
36 <a class="magick-nav-item " href="../command-line-tools.html">Tools</a>
37 <a class="magick-nav-item " href="../command-line-options.html">Options</a>
38 <a class="magick-nav-item " href="../resources.html">Resources</a>
39 <a class="magick-nav-item " href="api.html">Develop</a>
40 <a class="magick-nav-item " href="http://nextgen.imagemagick.org/script/search.php">Search</a>
41 <a class="magick-nav-item pull-right" href="http://www.imagemagick.org/discourse-server/">Community</a>
45 <div class="container">
46 <div class="magick-header">
47 <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>
49 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="AcquireExceptionInfo">AcquireExceptionInfo</a></h2>
51 <p>AcquireExceptionInfo() allocates the ExceptionInfo structure.</p>
53 <p>The format of the AcquireExceptionInfo method is:</p>
56 ExceptionInfo *AcquireExceptionInfo(void)
59 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="ClearMagickException">ClearMagickException</a></h2>
61 <p>ClearMagickException() clears any exception that may not have been caught yet.</p>
63 <p>The format of the ClearMagickException method is:</p>
66 ClearMagickException(ExceptionInfo *exception)
69 <p>A description of each parameter follows:</p>
75 <dl class="dl-horizontal">
77 <dd>the exception info. </dd>
81 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="CatchException">CatchException</a></h2>
83 <p>CatchException() returns if no exceptions is found otherwise it reports the exception as a warning, error, or fatal depending on the severity.</p>
85 <p>The format of the CatchException method is:</p>
88 CatchException(ExceptionInfo *exception)
91 <p>A description of each parameter follows:</p>
97 <dl class="dl-horizontal">
99 <dd>the exception info. </dd>
103 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="CloneExceptionInfo">CloneExceptionInfo</a></h2>
105 <p>CloneExceptionInfo() clones the ExceptionInfo structure.</p>
107 <p>The format of the CloneExceptionInfo method is:</p>
110 ExceptionInfo *CloneException(ExceptionInfo *exception)
113 <p>A description of each parameter follows:</p>
119 <dl class="dl-horizontal">
121 <dd>the exception info. </dd>
125 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="DestroyExceptionInfo">DestroyExceptionInfo</a></h2>
127 <p>DestroyExceptionInfo() deallocates memory associated with an exception.</p>
129 <p>The format of the DestroyExceptionInfo method is:</p>
132 ExceptionInfo *DestroyExceptionInfo(ExceptionInfo *exception)
135 <p>A description of each parameter follows:</p>
141 <dl class="dl-horizontal">
143 <dd>the exception info. </dd>
147 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="GetExceptionMessage">GetExceptionMessage</a></h2>
149 <p>GetExceptionMessage() returns the error message defined by the specified error code.</p>
151 <p>The format of the GetExceptionMessage method is:</p>
154 char *GetExceptionMessage(const int error)
157 <p>A description of each parameter follows:</p>
163 <dl class="dl-horizontal">
165 <dd>the error code. </dd>
169 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="GetLocaleExceptionMessage">GetLocaleExceptionMessage</a></h2>
171 <p>GetLocaleExceptionMessage() converts a enumerated exception severity and tag to a message in the current locale.</p>
173 <p>The format of the GetLocaleExceptionMessage method is:</p>
176 const char *GetLocaleExceptionMessage(const ExceptionType severity,
180 <p>A description of each parameter follows:</p>
186 <dl class="dl-horizontal">
188 <dd>the severity of the exception. </dd>
192 <dd>the message tag. </dd>
196 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="InheritException">InheritException</a></h2>
198 <p>InheritException() inherits an exception from a related exception.</p>
200 <p>The format of the InheritException method is:</p>
203 InheritException(ExceptionInfo *exception,const ExceptionInfo *relative)
206 <p>A description of each parameter follows:</p>
212 <dl class="dl-horizontal">
214 <dd>the exception info. </dd>
218 <dd>the related exception info. </dd>
222 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="InitializeExceptionInfo">InitializeExceptionInfo</a></h2>
224 <p>InitializeExceptionInfo() initializes an exception to default values.</p>
226 <p>The format of the InitializeExceptionInfo method is:</p>
229 InitializeExceptionInfo(ExceptionInfo *exception)
232 <p>A description of each parameter follows:</p>
238 <dl class="dl-horizontal">
240 <dd>the exception info. </dd>
244 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="MagickError">MagickError</a></h2>
246 <p>MagickError() calls the exception handler methods with an error reason.</p>
248 <p>The format of the MagickError method is:</p>
251 void MagickError(const ExceptionType error,const char *reason,
252 const char *description)
255 <p>A description of each parameter follows:</p>
261 <dl class="dl-horizontal">
263 <dd>Specifies the numeric error category. </dd>
267 <dd>Specifies the reason to display before terminating the program. </dd>
271 <dd>Specifies any description to the reason. </dd>
275 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="MagickFatalError">MagickFatalError</a></h2>
277 <p>MagickFatalError() calls the fatal exception handler methods with an error reason.</p>
279 <p>The format of the MagickError method is:</p>
282 void MagickFatalError(const ExceptionType error,const char *reason,
283 const char *description)
286 <p>A description of each parameter follows:</p>
292 <dl class="dl-horizontal">
294 <dd>Specifies the numeric error category. </dd>
298 <dd>Specifies the reason to display before terminating the program. </dd>
302 <dd>Specifies any description to the reason. </dd>
306 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="MagickWarning">MagickWarning</a></h2>
308 <p>MagickWarning() calls the warning handler methods with a warning reason.</p>
310 <p>The format of the MagickWarning method is:</p>
313 void MagickWarning(const ExceptionType warning,const char *reason,
314 const char *description)
317 <p>A description of each parameter follows:</p>
323 <dl class="dl-horizontal">
325 <dd>the warning severity. </dd>
329 <dd>Define the reason for the warning. </dd>
333 <dd>Describe the warning. </dd>
337 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="SetErrorHandler">SetErrorHandler</a></h2>
339 <p>SetErrorHandler() sets the exception handler to the specified method and returns the previous exception handler.</p>
341 <p>The format of the SetErrorHandler method is:</p>
344 ErrorHandler SetErrorHandler(ErrorHandler handler)
347 <p>A description of each parameter follows:</p>
353 <dl class="dl-horizontal">
355 <dd>the method to handle errors. </dd>
359 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="SetFatalErrorHandler">SetFatalErrorHandler</a></h2>
361 <p>SetFatalErrorHandler() sets the fatal exception handler to the specified method and returns the previous fatal exception handler.</p>
363 <p>The format of the SetErrorHandler method is:</p>
366 ErrorHandler SetErrorHandler(ErrorHandler handler)
369 <p>A description of each parameter follows:</p>
375 <dl class="dl-horizontal">
377 <dd>the method to handle errors. </dd>
381 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="SetWarningHandler">SetWarningHandler</a></h2>
383 <p>SetWarningHandler() sets the warning handler to the specified method and returns the previous warning handler.</p>
385 <p>The format of the SetWarningHandler method is:</p>
388 ErrorHandler SetWarningHandler(ErrorHandler handler)
391 <p>A description of each parameter follows:</p>
397 <dl class="dl-horizontal">
399 <dd>the method to handle warnings. </dd>
403 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="ThrowException">ThrowException</a></h2>
405 <p>ThrowException() throws an exception with the specified severity code, reason, and optional description.</p>
407 <p>The format of the ThrowException method is:</p>
410 MagickBooleanType ThrowException(ExceptionInfo *exception,
411 const ExceptionType severity,const char *reason,
412 const char *description)
415 <p>A description of each parameter follows:</p>
421 <dl class="dl-horizontal">
423 <dd>the exception info. </dd>
427 <dd>the severity of the exception. </dd>
431 <dd>the reason for the exception. </dd>
435 <dd>the exception description. </dd>
440 <footer class="magick-footer">
441 <p><a href="../support.html">Donate</a> •
442 <a href="../sitemap.html">Sitemap</a> •
443 <a href="../links.html">Related</a> •
444 <a href="../architecture.html">Architecture</a>
446 <p><a href="exception.html#">Back to top</a> •
447 <a href="http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x89AB63D48277377A">Public Key</a> •
448 <a href="http://nextgen.imagemagick.org/script/contact.php">Contact Us</a></p>
449 <p><small>© 1999-2015 ImageMagick Studio LLC</small></p>
451 </div><!-- /.container -->
453 <script src="http://nextgen.imagemagick.org/js/magick.html"></script>