1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>error - Dealing with Errors</title>
<link rel="stylesheet" type="text/css" href="../magick.css">
</head>
<body marginheight="1" marginwidth="1" topmargin="1" leftmargin="1">
<a name="top"></a>
<table border="0" cellpadding="0" cellspacing="0" summary="Masthead" width="100%">
<tbody>
<tr>
<td bgcolor="#003399" width="25%" height="118" background="../../images/background.gif"><a href="http://www.imagemagick.org/"><img src="../../images/script.gif" width="278" height="118" border="0" alt="" /></a></td>
<td bgcolor="#003399" width="60%" height="118" background="../../images/background.gif"><a href="http://www.networkeleven.com/direct.php?magick_all"><img src="../../images/promote.png" border="0" width="186" height="52" vspace="29" alt="Powered by NetworkEleven" /></a></td>
<td bgcolor="#003399" width="114" height="118" align="right"><img src="../../images/sprite.png" width="114" height="118" alt="" /></td>
<td bgcolor="#003399" width="114" height="118" align="right"><a href="http://www.imagemagick.net"><img src="../../images/logo.png" width="114" height="118" border="0" alt="ImageMagick logo" /></a></td>
</tr></tbody></table>
<table align="left" border="0" cellpadding="2" cellspacing="2" summary="Navigation buttons" width="20%">
<tr>
<td>
<form target="_self" action="../../index.html"><input type="submit" title="ImageMagick Home" value=" Home" style="background-color: #1947A3; background-image:url('../../../images/background.gif'); color:#fbc713; font-weight:bold"></form></td>
<td>
<form target="_self" action="../../www/apis.html"><input type="submit" title="ImageMagick API" value=" API " style="background-color: #1947A3; background-image:url('../../../images/background.gif'); color:#fbc713; font-weight:bold"></form></td>
<td>
<form target="_self" action="../../www/archives.html"><input type="submit" title="ImageMagick Download" value="Download" style="background-color: #1947A3; background-image:url('../../../images/background.gif'); color:#fbc713; font-weight:bold"></form></td></tr></table>
<div align="right" style="margin-top:3px; padding-right:4px">
<form action="http://studio.imagemagick.org/Sage/scripts/Sage.cgi"><input type="TEXT" name="query" size="32" maxlength="255"> <input type="SUBMIT" name="sa" value="Search" style="background-color: #1947A3; background-image:url('../../../images/background.gif'); bgcolor:#003399; color:#fbc713; font-weight:bold"></form></div>
<table align="left" border="0" cellpadding="10" cellspacing="0" style="margin-top:-17px" width="100%">
<tr>
<td>
<P><a name="__index__"></a></P>
<!-- INDEX BEGIN -->
<ul>
<li><a href="#name">NAME</a></li>
<li><a href="#synopsis">SYNOPSIS</a></li>
<li><a href="#function_descriptions">FUNCTION DESCRIPTIONS</a></li>
<ul>
<li><a href="#catchexception">CatchException</a></li>
<li><a href="#destroyexceptioninfo">DestroyExceptionInfo</a></li>
<li><a href="#getexceptioninfo">GetExceptionInfo</a></li>
<li><a href="#getlocaleexceptionmessage">GetLocaleExceptionMessage</a></li>
<li><a href="#inheritexception">InheritException</a></li>
<li><a href="#magickerror">MagickError</a></li>
<li><a href="#magickwarning">MagickWarning</a></li>
<li><a href="#seterrorhandler">SetErrorHandler</a></li>
<li><a href="#setexceptioninfo">SetExceptionInfo</a></li>
<li><a href="#setfatalerrorhandler">SetFatalErrorHandler</a></li>
<li><a href="#setwarninghandler">SetWarningHandler</a></li>
<li><a href="#throwexception">ThrowException</a></li>
<li><a href="#throwmagickexception">ThrowMagickException</a></li>
</ul>
</ul>
<!-- INDEX END -->
<hr />
<P>
</P>
<h1><a name="name">NAME</a></h1>
<P>error - Dealing with Errors</P>
<P>
</P>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<P><strong>CatchException</strong>( ExceptionInfo *exception );</P>
<P>void <strong>DestroyExceptionInfo</strong>( ExceptionInfo *exception );</P>
<P><strong>GetExceptionInfo</strong>( ExceptionInfo *exception );</P>
<P>const char * <strong>GetLocaleExceptionMessage</strong>( const ExceptionType severity, const char *tag );</P>
<P><strong>InheritException</strong>( ExceptionInfo *exception, const ExceptionInfo *relative );</P>
<P>void <strong>MagickError</strong>( const ExceptionType error, const char *reason, const char *description );</P>
<P>void <strong>MagickWarning</strong>( const ExceptionType warning, const char *reason, const char *description );</P>
<P>ErrorHandler <strong>SetErrorHandler</strong>( ErrorHandler handler );</P>
<P>MagickBooleanType <strong>SetExceptionInfo</strong>( ExceptionInfo *exception, ExceptionType severity );</P>
<P>ErrorHandler <strong>SetWarningHandler</strong>( ErrorHandler handler );</P>
<P>MagickBooleanType <strong>ThrowException</strong>( ExceptionInfo *exception_info, const ExceptionType severity, const char *reason, const char *description );</P>
<P>
</P>
<hr />
<h1><a name="function_descriptions">FUNCTION DESCRIPTIONS</a></h1>
<P>
</P>
<h2><a name="catchexception">CatchException</a></h2>
<blockquote>CatchException() returns if no exceptions is found otherwise it reports the exception as a warning, error, or fatal depending on the severity. </blockquote><P>The format of the CatchException method is:</P>
<blockquote>CatchException ( <A HREF="types.html#ExceptionInfo">ExceptionInfo</A> *exception ); </blockquote><P>A description of each parameter follows:</P>
<dl>
<dt><strong><a name="item_o_exception_3a">exception:</a></strong><br />
</dt>
<DD>
The exception info.
</dd>
<P></P></dl>
<P>
</P>
<h2><a name="destroyexceptioninfo">DestroyExceptionInfo</a></h2>
<blockquote>DestroyExceptionInfo() deallocates memory associated with exception. </blockquote><P>The format of the DestroyExceptionInfo method is:</P>
<blockquote>void DestroyExceptionInfo ( <A HREF="types.html#ExceptionInfo">ExceptionInfo</A> *exception ); </blockquote><P>A description of each parameter follows:</P>
<dl>
<dt><strong>exception:</strong><br />
</dt>
<DD>
The exception info.
</dd>
<P></P></dl>
<P>
</P>
<h2><a name="getexceptioninfo">GetExceptionInfo</a></h2>
<blockquote>GetExceptionInfo() initializes an exception to default values. </blockquote><P>The format of the GetExceptionInfo method is:</P>
<blockquote>GetExceptionInfo ( <A HREF="types.html#ExceptionInfo">ExceptionInfo</A> *exception ); </blockquote><P>A description of each parameter follows:</P>
<dl>
<dt><strong>exception:</strong><br />
</dt>
<DD>
The exception info.
</dd>
<P></P></dl>
<P>
</P>
<h2><a name="getlocaleexceptionmessage">GetLocaleExceptionMessage</a></h2>
<blockquote>GetLocaleExceptionMessage() converts a enumerated exception severity and tag to a message in the current locale. </blockquote><P>The format of the GetLocaleExceptionMessage method is:</P>
<blockquote>const char *GetLocaleExceptionMessage ( const <A HREF="types.html#ExceptionType">ExceptionType</A> severity, const char *tag ); </blockquote><P>A description of each parameter follows:</P>
<dl>
<dt><strong><a name="item_o_severity_3a">severity:</a></strong><br />
</dt>
<DD>
the severity of the exception.
</dd>
<P></P>
<dt><strong><a name="item_o_tag_3a">tag:</a></strong><br />
</dt>
<DD>
the message tag.
</dd>
<P></P></dl>
<P>
</P>
<h2><a name="inheritexception">InheritException</a></h2>
<blockquote>InheritException() inherits an exception from a related exception. </blockquote><P>The format of the InheritException method is:</P>
<blockquote>InheritException ( <A HREF="types.html#ExceptionInfo">ExceptionInfo</A> *exception, const <A HREF="types.html#ExceptionInfo">ExceptionInfo</A> *relative ); </blockquote><P>A description of each parameter follows:</P>
<dl>
<dt><strong>exception:</strong><br />
</dt>
<DD>
The exception info.
</dd>
<P></P>
<dt><strong><a name="item_o_relative_3a">relative:</a></strong><br />
</dt>
<DD>
The related exception info.
</dd>
<P></P></dl>
<P>
</P>
<h2><a name="magickerror">MagickError</a></h2>
<blockquote>MagickError() calls the error handler methods with an error reason. </blockquote><P>The format of the MagickError method is:</P>
<blockquote>void MagickError ( const <A HREF="types.html#ExceptionType">ExceptionType</A> error, const char *reason, const char *description ); </blockquote><P>A description of each parameter follows:</P>
<dl>
<dt><strong>exception:</strong><br />
</dt>
<DD>
Specifies the numeric error category.
</dd>
<P></P>
<dt><strong><a name="item_o_reason_3a">reason:</a></strong><br />
</dt>
<DD>
Specifies the reason to display before terminating the program.
</dd>
<P></P>
<dt><strong><a name="item_o_description_3a">description:</a></strong><br />
</dt>
<DD>
Specifies any description to the reason.
</dd>
<P></P></dl>
<P><code>MagickFatalError()</code> calls the fatal error handler methods with an error reason.</P>
<P>The format of the MagickError method is:</P>
<pre>
void MagickFatalError(const ExceptionType error,const char *reason,
const char *description)</pre>
<P>A description of each parameter follows:</P>
<dl>
<dt><strong>exception:</strong><br />
</dt>
<DD>
Specifies the numeric error category.
</dd>
<P></P>
<dt><strong>reason:</strong><br />
</dt>
<DD>
Specifies the reason to display before terminating the program.
</dd>
<P></P>
<dt><strong>description:</strong><br />
</dt>
<DD>
Specifies any description to the reason.
</dd>
<P></P></dl>
<P>
</P>
<h2><a name="magickwarning">MagickWarning</a></h2>
<blockquote>MagickWarning() calls the warning handler methods with a warning reason. </blockquote><P>The format of the MagickWarning method is:</P>
<blockquote>void MagickWarning ( const <A HREF="types.html#ExceptionType">ExceptionType</A> warning, const char *reason, const char *description ); </blockquote><P>A description of each parameter follows:</P>
<dl>
<dt><strong><a name="item_o_warning_3a">warning:</a></strong><br />
</dt>
<DD>
The warning severity.
</dd>
<P></P>
<dt><strong>reason:</strong><br />
</dt>
<DD>
Define the reason for the warning.
</dd>
<P></P>
<dt><strong>description:</strong><br />
</dt>
<DD>
Describe the warning.
</dd>
<P></P></dl>
<P>
</P>
<h2><a name="seterrorhandler">SetErrorHandler</a></h2>
<blockquote>SetErrorHandler() sets the error handler to the specified method and returns the previous error handler. </blockquote><P>The format of the SetErrorHandler method is:</P>
<blockquote><A HREF="types.html#ErrorHandler">ErrorHandler</A> SetErrorHandler ( <A HREF="types.html#ErrorHandler">ErrorHandler</A> handler ); </blockquote><P>A description of each parameter follows:</P>
<dl>
<dt><strong><a name="item_o_handler_3a">handler:</a></strong><br />
</dt>
<DD>
The method to handle errors.
</dd>
<P></P></dl>
<P>
</P>
<h2><a name="setexceptioninfo">SetExceptionInfo</a></h2>
<blockquote>SetExceptionInfo() set the exception severity. </blockquote><P>The format of the SetExceptionInfo method is:</P>
<blockquote>MagickBooleanType SetExceptionInfo ( <A HREF="types.html#ExceptionInfo">ExceptionInfo</A> *exception, <A HREF="types.html#ExceptionType">ExceptionType</A> severity ); </blockquote><P>A description of each parameter follows:</P>
<dl>
<dt><strong>exception:</strong><br />
</dt>
<DD>
The exception info.
</dd>
<P></P>
<dt><strong>severity:</strong><br />
</dt>
<DD>
The exception severity.
</dd>
<P></P></dl>
<P>
</P>
<h2><a name="setfatalerrorhandler">SetFatalErrorHandler</a></h2>
<blockquote>SetFatalErrorHandler() sets the fatal error handler to the specified method and returns the previous fatal error handler. </blockquote><P>The format of the SetErrorHandler method is:</P>
<pre>
ErrorHandler SetErrorHandler(ErrorHandler handler)</pre>
<P>A description of each parameter follows:</P>
<dl>
<dt><strong>handler:</strong><br />
</dt>
<DD>
The method to handle errors.
</dd>
<P></P></dl>
<P>
</P>
<h2><a name="setwarninghandler">SetWarningHandler</a></h2>
<blockquote>SetWarningHandler() sets the warning handler to the specified method and returns the previous warning handler. </blockquote><P>The format of the SetWarningHandler method is:</P>
<blockquote><A HREF="types.html#ErrorHandler">ErrorHandler</A> SetWarningHandler ( <A HREF="types.html#ErrorHandler">ErrorHandler</A> handler ); </blockquote><P>A description of each parameter follows:</P>
<dl>
<dt><strong>handler:</strong><br />
</dt>
<DD>
The method to handle warnings.
</dd>
<P></P></dl>
<P>
</P>
<h2><a name="throwexception">ThrowException</a></h2>
<blockquote>ThrowException() throws an exception with the specified severity code, reason, and optional description. </blockquote><P>The format of the ThrowException method is:</P>
<blockquote>MagickBooleanType ThrowException ( <A HREF="types.html#ExceptionInfo">ExceptionInfo</A> *exception_info, const <A HREF="types.html#ExceptionType">ExceptionType</A> severity, const char *reason, const char *description ); </blockquote><P>A description of each parameter follows:</P>
<dl>
<dt><strong><a name="item_o_exception_info_3a">exception_info:</a></strong><br />
</dt>
<DD>
The exception info.
</dd>
<P></P>
<dt><strong>severity:</strong><br />
</dt>
<DD>
The severity of the exception.
</dd>
<P></P>
<dt><strong>tag:</strong><br />
</dt>
<DD>
The message tag.
</dd>
<P></P>
<dt><strong>description:</strong><br />
</dt>
<DD>
The exception description.
</dd>
<P></P></dl>
<P>
</P>
<h2><a name="throwmagickexception">ThrowMagickException</a></h2>
<P>ThrowMagickException logs an exception as determined by the log configuration file. If an error occurs, MagickFalse is returned otherwise MagickTrue.</P>
<P>The format of the ThrowMagickException method is:</P>
<pre>
MagickBooleanType ThrowFileException(ExceptionInfo *exception,
const char *module,const char *function,const unsigned long line,
const ExceptionType severity,const char *tag,...)</pre>
<P>A description of each parameter follows:</P>
<dl>
<dt><strong>exception_info:</strong><br />
</dt>
<DD>
The exception info.
</dd>
<P></P>
<dt><strong><a name="item_o_filename_3a">filename:</a></strong><br />
</dt>
<DD>
The source module filename.
</dd>
<P></P>
<dt><strong><a name="item_o_function_3a">function:</a></strong><br />
</dt>
<DD>
The function name.
</dd>
<P></P>
<dt><strong><a name="item_o_line_3a">line:</a></strong><br />
</dt>
<DD>
The line number of the source module.
</dd>
<P></P>
<dt><strong>severity:</strong><br />
</dt>
<DD>
Specifies the numeric error category.
</dd>
<P></P>
<dt><strong>reason:</strong><br />
</dt>
<DD>
Specifies the reason to for the exception.
</dd>
<P></P>
<dt><strong>description:</strong><br />
</dt>
<DD>
Specifies a description of the exception.
</dd>
</dl>
<HR>
<a href="#top"><img src="../../../images/top.gif" border=0 width=42 height=42 align="right" alt="Top of page"></a>
<form action="http://studio.imagemagick.org/magick/" style="margin-top:5px">
<input type="submit" title="Help!" value="Help!" style="background-image:url('../../../images/background.gif'); color:#fbc713; font-weight:bold">
<small>"Image manipulation software that works like magick"</small>
</form></td>
</tr></table>
</body>
</html>
|