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