MagickCore  6.9.12-67
Convert, Edit, Or Compose Bitmap Images
 All Data Structures
exception.h
1 /*
2  Copyright 1999-2021 ImageMagick Studio LLC, a non-profit organization
3  dedicated to making software imaging solutions freely available.
4 
5  You may not use this file except in compliance with the License. You may
6  obtain a copy of the License at
7 
8  https://imagemagick.org/script/license.php
9 
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.
15 
16  MagickCore exception methods.
17 */
18 #ifndef MAGICKCORE_EXCEPTION_H
19 #define MAGICKCORE_EXCEPTION_H
20 
21 #include <stdarg.h>
22 #include "magick/semaphore.h"
23 
24 #if defined(__cplusplus) || defined(c_plusplus)
25 extern "C" {
26 #endif
27 
28 typedef enum
29 {
30  UndefinedException,
31  WarningException = 300,
32  ResourceLimitWarning = 300,
33  TypeWarning = 305,
34  OptionWarning = 310,
35  DelegateWarning = 315,
36  MissingDelegateWarning = 320,
37  CorruptImageWarning = 325,
38  FileOpenWarning = 330,
39  BlobWarning = 335,
40  StreamWarning = 340,
41  CacheWarning = 345,
42  CoderWarning = 350,
43  FilterWarning = 352,
44  ModuleWarning = 355,
45  DrawWarning = 360,
46  ImageWarning = 365,
47  WandWarning = 370,
48  RandomWarning = 375,
49  XServerWarning = 380,
50  MonitorWarning = 385,
51  RegistryWarning = 390,
52  ConfigureWarning = 395,
53  PolicyWarning = 399,
54  ErrorException = 400,
55  ResourceLimitError = 400,
56  TypeError = 405,
57  OptionError = 410,
58  DelegateError = 415,
59  MissingDelegateError = 420,
60  CorruptImageError = 425,
61  FileOpenError = 430,
62  BlobError = 435,
63  StreamError = 440,
64  CacheError = 445,
65  CoderError = 450,
66  FilterError = 452,
67  ModuleError = 455,
68  DrawError = 460,
69  ImageError = 465,
70  WandError = 470,
71  RandomError = 475,
72  XServerError = 480,
73  MonitorError = 485,
74  RegistryError = 490,
75  ConfigureError = 495,
76  PolicyError = 499,
77  FatalErrorException = 700,
78  ResourceLimitFatalError = 700,
79  TypeFatalError = 705,
80  OptionFatalError = 710,
81  DelegateFatalError = 715,
82  MissingDelegateFatalError = 720,
83  CorruptImageFatalError = 725,
84  FileOpenFatalError = 730,
85  BlobFatalError = 735,
86  StreamFatalError = 740,
87  CacheFatalError = 745,
88  CoderFatalError = 750,
89  FilterFatalError = 752,
90  ModuleFatalError = 755,
91  DrawFatalError = 760,
92  ImageFatalError = 765,
93  WandFatalError = 770,
94  RandomFatalError = 775,
95  XServerFatalError = 780,
96  MonitorFatalError = 785,
97  RegistryFatalError = 790,
98  ConfigureFatalError = 795,
99  PolicyFatalError = 799
100 } ExceptionType;
101 
103 {
104  ExceptionType
105  severity;
106 
107  int
108  error_number;
109 
110  char
111  *reason,
112  *description;
113 
114  void
115  *exceptions;
116 
117  MagickBooleanType
118  relinquish;
119 
121  *semaphore;
122 
123  size_t
124  signature;
125 };
126 
127 typedef void
128  (*ErrorHandler)(const ExceptionType,const char *,const char *);
129 
130 typedef void
131  (*FatalErrorHandler)(const ExceptionType,const char *,const char *);
132 
133 typedef void
134  (*WarningHandler)(const ExceptionType,const char *,const char *);
135 
136 extern MagickExport char
137  *GetExceptionMessage(const int);
138 
139 extern MagickExport const char
140  *GetLocaleExceptionMessage(const ExceptionType,const char *);
141 
142 extern MagickExport ErrorHandler
143  SetErrorHandler(ErrorHandler);
144 
145 extern MagickExport ExceptionInfo
146  *AcquireExceptionInfo(void),
147  *CloneExceptionInfo(ExceptionInfo *),
148  *DestroyExceptionInfo(ExceptionInfo *);
149 
150 extern MagickExport FatalErrorHandler
151  SetFatalErrorHandler(FatalErrorHandler);
152 
153 extern MagickExport MagickBooleanType
154  ThrowException(ExceptionInfo *,const ExceptionType,const char *,
155  const char *),
156  ThrowMagickException(ExceptionInfo *,const char *,const char *,const size_t,
157  const ExceptionType,const char *,const char *,...)
158  magick_attribute((__format__ (__printf__,7,8))),
159  ThrowMagickExceptionList(ExceptionInfo *,const char *,const char *,
160  const size_t,const ExceptionType,const char *,const char *,va_list)
161  magick_attribute((__format__ (__printf__,7,0)));
162 
163 extern MagickExport void
164  CatchException(ExceptionInfo *),
165  ClearMagickException(ExceptionInfo *),
166  InheritException(ExceptionInfo *,const ExceptionInfo *),
167  MagickError(const ExceptionType,const char *,const char *),
168  MagickFatalError(const ExceptionType,const char *,const char *),
169  MagickWarning(const ExceptionType,const char *,const char *);
170 
171 extern MagickExport WarningHandler
172  SetWarningHandler(WarningHandler);
173 
174 #if defined(__cplusplus) || defined(c_plusplus)
175 }
176 #endif
177 
178 #endif