2 Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization
3 dedicated to making software imaging solutions freely available.
5 You may not use this file except in compliance with the License.
6 obtain a copy of the License at
8 http://www.imagemagick.org/script/license.php
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
16 MagickCore exception private methods.
18 #ifndef _MAGICKCORE_EXCEPTION_PRIVATE_H
19 #define _MAGICKCORE_EXCEPTION_PRIVATE_H
21 #if defined(__cplusplus) || defined(c_plusplus)
25 #include "MagickCore/log.h"
26 #include "MagickCore/string_.h"
28 #define ThrowBinaryException(severity,tag,context) \
30 if (image != (Image *) NULL) \
31 (void) ThrowMagickException(exception,GetMagickModule(),severity, \
32 tag == (const char *) NULL ? "unknown" : tag,"'%s'",context); \
33 return(MagickFalse); \
35 #define ThrowFatalException(severity,tag) \
43 GetExceptionInfo(&exception); \
44 message=GetExceptionMessage(errno); \
45 (void) ThrowMagickException(&exception,GetMagickModule(),severity, \
46 tag == (const char *) NULL ? "unknown" : tag,"'%s'",message); \
47 message=DestroyString(message); \
48 CatchException(&exception); \
49 (void) DestroyExceptionInfo(&exception); \
52 #define ThrowFileException(exception,severity,tag,context) \
57 message=GetExceptionMessage(errno); \
58 (void) ThrowMagickException(exception,GetMagickModule(),severity, \
59 tag == (const char *) NULL ? "unknown" : tag,"'%s': %s",context,message); \
60 message=DestroyString(message); \
62 #define ThrowImageException(severity,tag) \
64 (void) ThrowMagickException(exception,GetMagickModule(),severity, \
65 tag == (const char *) NULL ? "unknown" : tag,"'%s'",image->filename); \
66 return((Image *) NULL); \
68 #define ThrowReaderException(severity,tag) \
70 (void) ThrowMagickException(exception,GetMagickModule(),severity, \
71 tag == (const char *) NULL ? "unknown" : tag,"'%s'",image_info->filename); \
72 if ((image) != (Image *) NULL) \
74 (void) CloseBlob(image); \
75 image=DestroyImageList(image); \
77 return((Image *) NULL); \
79 #define ThrowWriterException(severity,tag) \
81 (void) ThrowMagickException(exception,GetMagickModule(),severity, \
82 tag == (const char *) NULL ? "unknown" : tag,"'%s'",image->filename); \
83 if (image_info->adjoin != MagickFalse) \
84 while (image->previous != (Image *) NULL) \
85 image=image->previous; \
86 (void) CloseBlob(image); \
87 return(MagickFalse); \
90 #if defined(__cplusplus) || defined(c_plusplus)